Image-Text-to-Text
Transformers
Safetensors
llava_qwen
text-generation
image-difference-captioning
multimodal
multi-image
llava
qwen2
siglip
m3diff
conversational
Instructions to use IVC-liuyuan/M3Diff with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IVC-liuyuan/M3Diff with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="IVC-liuyuan/M3Diff") 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("IVC-liuyuan/M3Diff", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IVC-liuyuan/M3Diff with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IVC-liuyuan/M3Diff" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IVC-liuyuan/M3Diff", "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/IVC-liuyuan/M3Diff
- SGLang
How to use IVC-liuyuan/M3Diff 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 "IVC-liuyuan/M3Diff" \ --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": "IVC-liuyuan/M3Diff", "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 "IVC-liuyuan/M3Diff" \ --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": "IVC-liuyuan/M3Diff", "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 IVC-liuyuan/M3Diff with Docker Model Runner:
docker model run hf.co/IVC-liuyuan/M3Diff
Download config.json from IVC-liuyuan/M3Diff: direct link, hf CLI and curl.
- Browser
- Download file 3.15 kB
-
https://huggingface.co/IVC-liuyuan/M3Diff/resolve/main/config.json
- Command line
-
hf download hf://IVC-liuyuan/M3Diff/config.json
-
curl -L -o config.json https://huggingface.co/IVC-liuyuan/M3Diff/resolve/main/config.json
3.15 kB
| { | |
| "_name_or_path": "IVC-liuyuan/M3Diff", | |
| "architectures": [ | |
| "LlavaQwenForCausalLM" | |
| ], | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 151643, | |
| "eos_token_id": 151645, | |
| "freeze_mm_mlp_adapter": false, | |
| "hidden_act": "silu", | |
| "hidden_size": 3584, | |
| "image_aspect_ratio": "pad", | |
| "image_crop_resolution": null, | |
| "image_grid_pinpoints": [ | |
| [ | |
| 384, | |
| 384 | |
| ], | |
| [ | |
| 384, | |
| 768 | |
| ], | |
| [ | |
| 384, | |
| 1152 | |
| ], | |
| [ | |
| 384, | |
| 1536 | |
| ], | |
| [ | |
| 384, | |
| 1920 | |
| ], | |
| [ | |
| 384, | |
| 2304 | |
| ], | |
| [ | |
| 768, | |
| 384 | |
| ], | |
| [ | |
| 768, | |
| 768 | |
| ], | |
| [ | |
| 768, | |
| 1152 | |
| ], | |
| [ | |
| 768, | |
| 1536 | |
| ], | |
| [ | |
| 768, | |
| 1920 | |
| ], | |
| [ | |
| 768, | |
| 2304 | |
| ], | |
| [ | |
| 1152, | |
| 384 | |
| ], | |
| [ | |
| 1152, | |
| 768 | |
| ], | |
| [ | |
| 1152, | |
| 1152 | |
| ], | |
| [ | |
| 1152, | |
| 1536 | |
| ], | |
| [ | |
| 1152, | |
| 1920 | |
| ], | |
| [ | |
| 1152, | |
| 2304 | |
| ], | |
| [ | |
| 1536, | |
| 384 | |
| ], | |
| [ | |
| 1536, | |
| 768 | |
| ], | |
| [ | |
| 1536, | |
| 1152 | |
| ], | |
| [ | |
| 1536, | |
| 1536 | |
| ], | |
| [ | |
| 1536, | |
| 1920 | |
| ], | |
| [ | |
| 1536, | |
| 2304 | |
| ], | |
| [ | |
| 1920, | |
| 384 | |
| ], | |
| [ | |
| 1920, | |
| 768 | |
| ], | |
| [ | |
| 1920, | |
| 1152 | |
| ], | |
| [ | |
| 1920, | |
| 1536 | |
| ], | |
| [ | |
| 1920, | |
| 1920 | |
| ], | |
| [ | |
| 1920, | |
| 2304 | |
| ], | |
| [ | |
| 2304, | |
| 384 | |
| ], | |
| [ | |
| 2304, | |
| 768 | |
| ], | |
| [ | |
| 2304, | |
| 1152 | |
| ], | |
| [ | |
| 2304, | |
| 1536 | |
| ], | |
| [ | |
| 2304, | |
| 1920 | |
| ], | |
| [ | |
| 2304, | |
| 2304 | |
| ] | |
| ], | |
| "image_split_resolution": null, | |
| "image_token_index": 151646, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 18944, | |
| "max_position_embeddings": 32768, | |
| "max_window_layers": 28, | |
| "mdp_args": { | |
| "attention_downsample_rate": 1, | |
| "feature_dim": 1152, | |
| "ffn_hidden_dim": 4608, | |
| "num_refinement_layers": 2 | |
| }, | |
| "mm_hidden_size": 1152, | |
| "mm_newline_position": "one_token", | |
| "mm_patch_merge_type": "flat", | |
| "mm_projector_lr": 1e-05, | |
| "mm_projector_type": "mlp2x_gelu", | |
| "mm_resampler_type": "mdp", | |
| "mm_spatial_pool_mode": "bilinear", | |
| "mm_tunable_parts": "mm_vision_tower,mm_mlp_adapter,mm_language_model", | |
| "mm_use_im_patch_token": false, | |
| "mm_use_im_start_end": false, | |
| "mm_vision_select_feature": "patch", | |
| "mm_vision_select_layer": "[-11,-8,-5,-2]", | |
| "mm_vision_tower": "google/siglip-so400m-patch14-384", | |
| "mm_vision_tower_lr": 2e-06, | |
| "model_type": "llava_qwen", | |
| "num_attention_heads": 28, | |
| "num_hidden_layers": 28, | |
| "num_key_value_heads": 4, | |
| "pos_skipping_range": 4096, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": null, | |
| "rope_theta": 1000000.0, | |
| "sliding_window": 131072, | |
| "tie_word_embeddings": false, | |
| "tokenizer_model_max_length": 4096, | |
| "tokenizer_padding_side": "right", | |
| "torch_dtype": "float16", | |
| "transformers_version": "4.40.0", | |
| "tune_mm_mlp_adapter": false, | |
| "tune_mm_vision_resampler": true, | |
| "unfreeze_mm_vision_tower": true, | |
| "use_cache": true, | |
| "use_mm_proj": true, | |
| "use_pos_skipping": false, | |
| "use_sliding_window": false, | |
| "vocab_size": 152064 | |
| } | |