Image-Text-to-Text
Transformers
Safetensors
English
llava-qwen2
text-generation
llava
multimodal
qwen
conversational
custom_code
Instructions to use qnguyen3/nanoLLaVA-1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qnguyen3/nanoLLaVA-1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="qnguyen3/nanoLLaVA-1.5", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("qnguyen3/nanoLLaVA-1.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use qnguyen3/nanoLLaVA-1.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qnguyen3/nanoLLaVA-1.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qnguyen3/nanoLLaVA-1.5", "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/qnguyen3/nanoLLaVA-1.5
- SGLang
How to use qnguyen3/nanoLLaVA-1.5 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 "qnguyen3/nanoLLaVA-1.5" \ --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": "qnguyen3/nanoLLaVA-1.5", "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 "qnguyen3/nanoLLaVA-1.5" \ --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": "qnguyen3/nanoLLaVA-1.5", "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 qnguyen3/nanoLLaVA-1.5 with Docker Model Runner:
docker model run hf.co/qnguyen3/nanoLLaVA-1.5
File size: 1,258 Bytes
a1de9a4 5217ab3 a1de9a4 f2ae91e a1de9a4 85f5b87 a1de9a4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | {
"_name_or_path": "qnguyen3/nanoLLaVA-1.5",
"architectures": [
"BunnyQwenForCausalLM"
],
"attention_dropout": 0.0,
"auto_map": {
"AutoConfig": "configuration_llava_qwen2.LlavaQwen2Config",
"AutoModelForCausalLM": "modeling_llava_qwen2.LlavaQwen2ForCausalLM"
},
"bos_token_id": 151645,
"eos_token_id": 151645,
"freeze_mm_mlp_adapter": false,
"hidden_act": "silu",
"hidden_size": 1024,
"image_aspect_ratio": "pad",
"initializer_range": 0.02,
"intermediate_size": 2816,
"language_model": "vilm/Quyen-SE-v0.1",
"max_position_embeddings": 32768,
"max_window_layers": 21,
"mm_hidden_size": 1152,
"mm_projector_lr": null,
"mm_projector_type": "mlp2x_gelu",
"mm_vision_tower": "google/siglip-so400m-patch14-384",
"model_type": "llava-qwen2",
"num_attention_heads": 16,
"num_hidden_layers": 24,
"num_key_value_heads": 16,
"rms_norm_eps": 1e-06,
"rope_theta": 1000000.0,
"sliding_window": 4096,
"tie_word_embeddings": false,
"tokenizer_model_max_length": 4096,
"tokenizer_padding_side": "right",
"torch_dtype": "bfloat16",
"transformers_version": "4.41.1",
"tune_mm_mlp_adapter": false,
"use_cache": true,
"use_mm_proj": true,
"use_sliding_window": false,
"vocab_size": 151936
}
|