Instructions to use lmms-lab/LLaVA-OneVision-1.5-8B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lmms-lab/LLaVA-OneVision-1.5-8B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lmms-lab/LLaVA-OneVision-1.5-8B-Base", trust_remote_code=True) 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 AutoModel model = AutoModel.from_pretrained("lmms-lab/LLaVA-OneVision-1.5-8B-Base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lmms-lab/LLaVA-OneVision-1.5-8B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lmms-lab/LLaVA-OneVision-1.5-8B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmms-lab/LLaVA-OneVision-1.5-8B-Base", "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/lmms-lab/LLaVA-OneVision-1.5-8B-Base
- SGLang
How to use lmms-lab/LLaVA-OneVision-1.5-8B-Base 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 "lmms-lab/LLaVA-OneVision-1.5-8B-Base" \ --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": "lmms-lab/LLaVA-OneVision-1.5-8B-Base", "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 "lmms-lab/LLaVA-OneVision-1.5-8B-Base" \ --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": "lmms-lab/LLaVA-OneVision-1.5-8B-Base", "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 lmms-lab/LLaVA-OneVision-1.5-8B-Base with Docker Model Runner:
docker model run hf.co/lmms-lab/LLaVA-OneVision-1.5-8B-Base
Yiye commited on
Upload config.json with huggingface_hub
Browse files- config.json +94 -0
config.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LLaVAOneVision1_5_ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"image_token_id": 151655,
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration_llavaonevision1_5.Llavaonevision1_5Config",
|
| 8 |
+
"AutoModel": "modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration",
|
| 9 |
+
"AutoModelForCausalLM": "modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration"
|
| 10 |
+
},
|
| 11 |
+
"text_config": {
|
| 12 |
+
"attention_bias": false,
|
| 13 |
+
"attention_dropout": 0.0,
|
| 14 |
+
"head_dim": 128,
|
| 15 |
+
"hidden_act": "silu",
|
| 16 |
+
"hidden_size": 4096,
|
| 17 |
+
"image_token_id": null,
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"intermediate_size": 12288,
|
| 20 |
+
"tie_word_embeddings": false,
|
| 21 |
+
"layer_types": [
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"full_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"full_attention",
|
| 56 |
+
"full_attention",
|
| 57 |
+
"full_attention"
|
| 58 |
+
],
|
| 59 |
+
"max_position_embeddings": 32768,
|
| 60 |
+
"max_window_layers": 36,
|
| 61 |
+
"model_type": "LLaVAOneVision1_5_text",
|
| 62 |
+
"num_attention_heads": 32,
|
| 63 |
+
"num_hidden_layers": 36,
|
| 64 |
+
"num_key_value_heads": 8,
|
| 65 |
+
"rms_norm_eps": 1e-06,
|
| 66 |
+
"rope_scaling": null,
|
| 67 |
+
"rope_theta": 1000000.0,
|
| 68 |
+
"sliding_window": null,
|
| 69 |
+
"use_cache": true,
|
| 70 |
+
"use_sliding_window": false,
|
| 71 |
+
"video_token_id": null,
|
| 72 |
+
"vocab_size": 151936
|
| 73 |
+
},
|
| 74 |
+
"torch_dtype": "bfloat16",
|
| 75 |
+
"transformers_version": "4.53.0",
|
| 76 |
+
"video_token_id": 151656,
|
| 77 |
+
"vision_config": {
|
| 78 |
+
"depth": 24,
|
| 79 |
+
"embed_dim": 1024,
|
| 80 |
+
"hidden_act": "gelu",
|
| 81 |
+
"hidden_size": 1024,
|
| 82 |
+
"in_channels": 3,
|
| 83 |
+
"initializer_range": 0.02,
|
| 84 |
+
"intermediate_size": 4096,
|
| 85 |
+
"layer_norm_eps": 1e-05,
|
| 86 |
+
"model_type": "rice_vit",
|
| 87 |
+
"num_heads": 16,
|
| 88 |
+
"patch_size": 14,
|
| 89 |
+
"spatial_merge_size": 2,
|
| 90 |
+
"temporal_patch_size": 1,
|
| 91 |
+
"text_hidden_size": 4096
|
| 92 |
+
},
|
| 93 |
+
"vocab_size": 151936
|
| 94 |
+
}
|