Image-Text-to-Text
Transformers
Safetensors
English
llava_qwen2
text-generation
multimodal
conversational
custom_code
Instructions to use zhaode/FastVLM-1.5B-Stage2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zhaode/FastVLM-1.5B-Stage2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="zhaode/FastVLM-1.5B-Stage2", 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("zhaode/FastVLM-1.5B-Stage2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zhaode/FastVLM-1.5B-Stage2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zhaode/FastVLM-1.5B-Stage2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zhaode/FastVLM-1.5B-Stage2", "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/zhaode/FastVLM-1.5B-Stage2
- SGLang
How to use zhaode/FastVLM-1.5B-Stage2 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 "zhaode/FastVLM-1.5B-Stage2" \ --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": "zhaode/FastVLM-1.5B-Stage2", "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 "zhaode/FastVLM-1.5B-Stage2" \ --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": "zhaode/FastVLM-1.5B-Stage2", "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 zhaode/FastVLM-1.5B-Stage2 with Docker Model Runner:
docker model run hf.co/zhaode/FastVLM-1.5B-Stage2
| { | |
| "architectures": [ | |
| "LlavaQwen2ForCausalLM" | |
| ], | |
| "auto_map": { | |
| "AutoConfig": "llava_qwen.LlavaConfig", | |
| "AutoModelForCausalLM": "llava_qwen.LlavaQwen2ForCausalLM" | |
| }, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 151643, | |
| "eos_token_id": 151645, | |
| "freeze_mm_mlp_adapter": false, | |
| "hidden_act": "silu", | |
| "hidden_size": 1536, | |
| "image_aspect_ratio": "pad", | |
| "image_grid_pinpoints": null, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 8960, | |
| "max_position_embeddings": 32768, | |
| "max_window_layers": 28, | |
| "mm_hidden_size": 3072, | |
| "mm_patch_merge_type": "flat", | |
| "mm_projector_lr": null, | |
| "mm_projector_type": "mlp2x_gelu", | |
| "mm_use_im_patch_token": false, | |
| "mm_use_im_start_end": false, | |
| "mm_vision_select_feature": "patch", | |
| "mm_vision_select_layer": -2, | |
| "mm_vision_tower": "mobileclip_l_1024", | |
| "model_type": "llava_qwen2", | |
| "num_attention_heads": 12, | |
| "num_hidden_layers": 28, | |
| "num_key_value_heads": 2, | |
| "rms_norm_eps": 1e-06, | |
| "rope_theta": 1000000.0, | |
| "sliding_window": 32768, | |
| "tie_word_embeddings": true, | |
| "tokenizer_model_max_length": 8192, | |
| "tokenizer_padding_side": "right", | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.39.3", | |
| "tune_mm_mlp_adapter": false, | |
| "unfreeze_mm_vision_tower": true, | |
| "use_cache": true, | |
| "use_mm_proj": true, | |
| "use_sliding_window": false, | |
| "vocab_size": 151936 | |
| } | |