Image-Text-to-Text
Transformers
Safetensors
llava_next
llama-factory
full
Generated from Trainer
conversational
text-generation-inference
Instructions to use htlou/mm-interp-AA_text_image_to_text-llava-mistral with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use htlou/mm-interp-AA_text_image_to_text-llava-mistral with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="htlou/mm-interp-AA_text_image_to_text-llava-mistral") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("htlou/mm-interp-AA_text_image_to_text-llava-mistral") model = AutoModelForMultimodalLM.from_pretrained("htlou/mm-interp-AA_text_image_to_text-llava-mistral", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use htlou/mm-interp-AA_text_image_to_text-llava-mistral with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "htlou/mm-interp-AA_text_image_to_text-llava-mistral" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "htlou/mm-interp-AA_text_image_to_text-llava-mistral", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/htlou/mm-interp-AA_text_image_to_text-llava-mistral
- SGLang
How to use htlou/mm-interp-AA_text_image_to_text-llava-mistral with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "htlou/mm-interp-AA_text_image_to_text-llava-mistral" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "htlou/mm-interp-AA_text_image_to_text-llava-mistral", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "htlou/mm-interp-AA_text_image_to_text-llava-mistral" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "htlou/mm-interp-AA_text_image_to_text-llava-mistral", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use htlou/mm-interp-AA_text_image_to_text-llava-mistral with Docker Model Runner:
docker model run hf.co/htlou/mm-interp-AA_text_image_to_text-llava-mistral
AA_text_image_to_text
This model is a fine-tuned version of llava-hf/llava-v1.6-mistral-7b-hf on the AA_text_image_to_text dataset. It achieves the following results on the evaluation set:
- Loss: 0.4527
- Rewards/chosen: -0.6857
- Rewards/rejected: -4.3940
- Rewards/accuracies: 0.8165
- Rewards/margins: 3.7083
- Logps/rejected: -242.1480
- Logps/chosen: -207.1762
- Logits/rejected: -2.3240
- Logits/chosen: -2.3485
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-06
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- distributed_type: multi-GPU
- num_devices: 8
- gradient_accumulation_steps: 4
- total_train_batch_size: 256
- total_eval_batch_size: 64
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 10
- num_epochs: 3.0
Training results
| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.4889 | 0.2899 | 40 | 0.4642 | 1.1544 | -0.1887 | 0.7944 | 1.3431 | -200.0950 | -188.7752 | -1.9876 | -2.0351 |
| 0.3941 | 0.5797 | 80 | 0.4218 | -0.2275 | -2.2919 | 0.8044 | 2.0644 | -221.1273 | -202.5944 | -1.9449 | -1.9901 |
| 0.3717 | 0.8696 | 120 | 0.4387 | -0.2101 | -2.4885 | 0.8286 | 2.2784 | -223.0936 | -202.4208 | -2.0902 | -2.1229 |
| 0.1459 | 1.1594 | 160 | 0.4288 | -0.4029 | -3.3928 | 0.8286 | 2.9899 | -232.1363 | -204.3488 | -2.2733 | -2.3007 |
| 0.1455 | 1.4493 | 200 | 0.4255 | -0.5338 | -3.6331 | 0.8165 | 3.0992 | -234.5387 | -205.6577 | -2.2466 | -2.2697 |
| 0.1358 | 1.7391 | 240 | 0.4247 | -0.2714 | -3.6715 | 0.8327 | 3.4001 | -234.9227 | -203.0333 | -2.3605 | -2.3806 |
| 0.0938 | 2.0290 | 280 | 0.4128 | -0.3136 | -3.7007 | 0.8266 | 3.3870 | -235.2147 | -203.4556 | -2.3725 | -2.3933 |
| 0.0592 | 2.3188 | 320 | 0.4438 | -0.5767 | -4.1235 | 0.8165 | 3.5467 | -239.4429 | -206.0869 | -2.3109 | -2.3358 |
| 0.0673 | 2.6087 | 360 | 0.4553 | -0.6264 | -4.3005 | 0.8206 | 3.6740 | -241.2126 | -206.5837 | -2.3254 | -2.3497 |
| 0.0728 | 2.8986 | 400 | 0.4520 | -0.6855 | -4.3942 | 0.8185 | 3.7087 | -242.1503 | -207.1744 | -2.3247 | -2.3492 |
Framework versions
- Transformers 4.45.2
- Pytorch 2.4.0+cu121
- Datasets 2.21.0
- Tokenizers 0.20.3
- Downloads last month
- 5
Model tree for htlou/mm-interp-AA_text_image_to_text-llava-mistral
Base model
llava-hf/llava-v1.6-mistral-7b-hf