Instructions to use llava-hf/llava-1.5-7b-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use llava-hf/llava-1.5-7b-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="llava-hf/llava-1.5-7b-hf") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("llava-hf/llava-1.5-7b-hf") model = AutoModelForImageTextToText.from_pretrained("llava-hf/llava-1.5-7b-hf") 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
- vLLM
How to use llava-hf/llava-1.5-7b-hf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "llava-hf/llava-1.5-7b-hf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llava-hf/llava-1.5-7b-hf", "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/llava-hf/llava-1.5-7b-hf
- SGLang
How to use llava-hf/llava-1.5-7b-hf 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 "llava-hf/llava-1.5-7b-hf" \ --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": "llava-hf/llava-1.5-7b-hf", "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 "llava-hf/llava-1.5-7b-hf" \ --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": "llava-hf/llava-1.5-7b-hf", "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 llava-hf/llava-1.5-7b-hf with Docker Model Runner:
docker model run hf.co/llava-hf/llava-1.5-7b-hf
[Question] Why does LLaVA evaluation assert batch_size == 1 for benchmark inference?
1
#62 opened 5 days ago
by
austinkomachi
Multiple Image Tokens
2
#60 opened 6 months ago
by
rogergheser
question about multi-image support in llava-1.5-7b-hf
#59 opened 9 months ago
by
laolaorkk
Update chat_template.jinja
#58 opened 9 months ago
by
Leonardo6
Error Trying Inference
👀 3
1
#57 opened 10 months ago
by
JPLabsAI
Request: DOI
#56 opened 11 months ago
by
UdaraChamidu
No adapter_config.json
2
#55 opened 11 months ago
by
OwlMoy
General finetuning Notebooks
#53 opened about 1 year ago
by
dburkhart07
probability tensor contains either `inf`, `nan` or element < 0
#50 opened over 1 year ago
by
hadibeyzaee
Regarding suda and bitsandbytes (pls HELP)
1
#49 opened over 1 year ago
by
Anish-45
Can I use llava to finetune on my dataset for text-image classification? I have a image dataset with text information and it has multiple labels
#46 opened over 1 year ago
by
Udbhav23
Are there any recommended codebases for evaluating llava-hf models?
👀 2
#43 opened over 1 year ago
by
blameitonme1
The environment settings for fine-tuning the llava-1.5-7b-hf
👀 3
#42 opened over 1 year ago
by
ssxc16
Suddenly getting an error while executing processor = AutoProcessor.from_pretrained( 'llava-hf/llava-1.5-7b-hf')
👍 11
11
#41 opened over 1 year ago
by
Dipto084
How can I save or change the vision tower?
4
#40 opened over 1 year ago
by
plll123
Is it possible to only input text in LLaVa model?
➕ 2
4
#38 opened over 1 year ago
by
Tizzzzy
HELP
4
#37 opened over 1 year ago
by
eunhaeleee
llava-1.5-7b-hf run on cpu
#35 opened over 1 year ago
by
sdyy
is there difference between llava-hf/llava-1.5-7b-hf and liuhaotian/llava-v1.5-7b ???
3
#28 opened almost 2 years ago
by
hirasoooo
convert llava-v1.5-7b to liuhaotian/llava-v1.5-7b-hf format
22
#26 opened about 2 years ago
by deleted
Error during deploying llava-hf/llava-1.5-7b-hf using Amazon SageMaker
#25 opened about 2 years ago
by
dariahhlibova
Fine Tuning LLAVA for classification
1
#24 opened about 2 years ago
by
J812
How to fine-tune this model?
3
#23 opened about 2 years ago
by
LahalaHa
Hello, can you support the conversion of llava to onnx
1
#22 opened about 2 years ago
by
YinZiQi
ValueError: The input provided to the model are wrong.
2
#21 opened about 2 years ago
by
tkaintura
Consistency of results.
2
#20 opened over 2 years ago
by
areflesh
How to have a continuous conversation
6
#19 opened over 2 years ago
by
sucongCJS
image processing is different from the github version
3
#18 opened over 2 years ago
by
enhaoz
Error while finetuning the model for ConditionalGeneration
2
#16 opened over 2 years ago
by
alxenos
Why does it show `language_model = meta-llama/Llama-2-7b-hf` and not Vicuna?
6
#13 opened over 2 years ago
by
HenningBlue
Error with finetuning
5
#12 opened over 2 years ago
by
kshetrajna12
How would you finetune this model?
#11 opened over 2 years ago
by
cgrimshawdev26
Why is `beam_search` not enabled in the samples?
2
#10 opened over 2 years ago
by
floschne
Duration to generate a caption for 1 image
7
#9 opened over 2 years ago
by
apapiu
Why is the result differ from liuhaotian/llava-v1.5-7b
5
#8 opened over 2 years ago
by
wk21
transformers 4.35.3 is not released yet right ?
6
#1 opened over 2 years ago
by
mohan007