LLaVA Vietnamese AIO is a Vietnamese vision-language checkpoint for image understanding, visual question answering, and instruction-style multimodal responses. It combines a SigLIP2 vision encoder, a Llama 3.2 1B instruction model, and a trained multimodal projector in a standard Hugging Face Transformers LLaVA layout.
This repository stores the deployable inference checkpoint only. Optimizer, scheduler, and RNG states were intentionally excluded because they are needed only for training resume.
Model Details
Model type: LLaVA-style image-text-to-text model
Vision encoder:google/siglip2-so400m-patch16-384
Language model:meta-llama/Llama-3.2-1B-Instruct
Multimodal bridge: MLP projector
Primary language: Vietnamese
Checkpoint stage: instruction tuning
Checkpoint step:6000
Best validation metric:eval_loss = 1.0164677494163994
Checkpoint format: standard transformers.LlavaForConditionalGeneration checkpoint
Intended Use
This checkpoint is intended for Vietnamese multimodal experimentation and internal application prototyping, especially:
visual question answering in Vietnamese
short image-grounded instruction following
image description and scene understanding
local testing of the LLAVA project inference stack
It is not intended for safety-critical medical, legal, financial, identity, or surveillance decisions.
1import torch
2from PIL import Image
3from transformers import AutoProcessor, LlavaForConditionalGeneration
45repo_id ="VLAI-AIVN/llava-vietnamese-aio"67processor = AutoProcessor.from_pretrained(repo_id, use_fast=False)8model = LlavaForConditionalGeneration.from_pretrained(9 repo_id,10 dtype=torch.float16,11 device_map="auto",12 low_cpu_mem_usage=True,13)14model.eval()1516image = Image.open("sample.jpg").convert("RGB")17question ="Hãy mô tả nội dung chính của ảnh này."18messages =[19{20"role":"system",21"content":"Bạn là trợ lý thị giác tiếng Việt. Trả lời chính xác, ngắn gọn dựa trên hình ảnh.",22},23{"role":"user","content":f"<image>\n{question}"},24]2526prompt = processor.tokenizer.apply_chat_template(27 messages,28 tokenize=False,29 add_generation_prompt=True,30)31inputs = processor(text=prompt, images=image, return_tensors="pt", truncation=True, max_length=2048)32device =next(model.parameters()).device
33vision_dtype =next(model.vision_tower.parameters()).dtype
34inputs ={key: value.to(device)for key, value in inputs.items()}35inputs["pixel_values"]= inputs["pixel_values"].to(dtype=vision_dtype)3637eos_ids ={processor.tokenizer.eos_token_id}38for token in("<|eot_id|>","<|end_of_text|>"):39 token_id = processor.tokenizer.convert_tokens_to_ids(token)40ifisinstance(token_id,int)and token_id >=0:41 eos_ids.add(token_id)4243with torch.inference_mode():44 generated_ids = model.generate(45**inputs,46 max_new_tokens=256,47 do_sample=False,48 repetition_penalty=1.1,49 eos_token_id=sorted(i for i in eos_ids if i isnotNone),50 pad_token_id=processor.tokenizer.pad_token_id,51)5253input_len = inputs["input_ids"].shape[1]54answer = processor.tokenizer.decode(generated_ids[0, input_len:], skip_special_tokens=True).strip()55print(answer)
The repository still keeps the original project-native checkpoint files under llm/, processor/, tokenizer/, projector.pt, and lm_head.pt for reproducibility, but standard Transformers inference should use the root config.json, root processor/tokenizer files, and root model-*.safetensors shards.
Local Gradio Demo
This package includes a local Gradio app with the project logo in the header.
By default, the app uses this package as the checkpoint path and loads the model lazily on the first inference request. You can override runtime settings with environment variables:
Open the printed local URL, upload an image, enter a Vietnamese question, and run inference.
Training Details
The instruction-tuning run used the configuration snapshot in training_config.yaml.
Training stage:instruction_tuning
Mixed precision:bf16
Model dtype:bfloat16
Projector dtype:float32
Optimizer: Adafactor
Batch size:1
Gradient accumulation:16
Max text tokens:2048
Seed:42
Training Data
The training mix is defined in training_config.yaml and includes:
5CD-AI/Viet-ShareGPT-4o-Text-VQA
5CD-AI/Viet-Localization-VQA
Vietnam tourism image QA data prepared by the project pipeline
The configured sample weights were [40, 55, 5] for the three training sources above.
Evaluation
The best recorded internal validation loss for this checkpoint is:
eval_loss = 1.0164677494163994
No public benchmark score is reported yet. Treat the validation metric as an internal training signal, not as a broad claim of real-world performance.
Limitations
The model may hallucinate details that are not visible in the image.
The model is optimized for Vietnamese prompts and may be weaker on other languages.
OCR-heavy, fine-grained localization, counting, and small-object reasoning can be unreliable.
Fine-grained OCR, localization, counting, and small-object reasoning can be unreliable.
Performance depends on the prompt, image quality, and available inference hardware.
License and Usage
This checkpoint inherits usage constraints from its base models and training data. Review the license and acceptable-use terms for:
meta-llama/Llama-3.2-1B-Instruct
google/siglip2-so400m-patch16-384
the datasets listed in training_config.yaml
Redistribution and production deployment should happen only after confirming that the combined model, data, and application use case satisfy the upstream terms.
Citation and Acknowledgements
This work builds on the LLaVA-style multimodal architecture, Hugging Face Transformers, SigLIP2, and Llama 3.2. Please cite the relevant upstream projects and datasets when using this checkpoint in published work.