Image-Text-to-Text
Transformers
Safetensors
English
qwen2
text-generation
conversational
text-generation-inference
Instructions to use TIGER-Lab/MAmmoTH-VL2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/MAmmoTH-VL2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TIGER-Lab/MAmmoTH-VL2") 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 AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/MAmmoTH-VL2") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/MAmmoTH-VL2", device_map="auto") 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 = tokenizer.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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TIGER-Lab/MAmmoTH-VL2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/MAmmoTH-VL2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/MAmmoTH-VL2", "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/TIGER-Lab/MAmmoTH-VL2
- SGLang
How to use TIGER-Lab/MAmmoTH-VL2 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 "TIGER-Lab/MAmmoTH-VL2" \ --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": "TIGER-Lab/MAmmoTH-VL2", "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 "TIGER-Lab/MAmmoTH-VL2" \ --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": "TIGER-Lab/MAmmoTH-VL2", "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 TIGER-Lab/MAmmoTH-VL2 with Docker Model Runner:
docker model run hf.co/TIGER-Lab/MAmmoTH-VL2
Commit History
-
Update config.json
Verified signaturec6b8460
-
Update README.md
Verified signatureb10993f
-
Update README.md
Verified signature4508e16
-
Update README.md
Verified signaturef6e39c0 -
Update README.md
Verified signature24b2ebc
-
Correct pipeline tag (#1)
Verified signature- Correct pipeline tag (bedddae8e950ecfad44bc9ae48b6fb5463591456) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>9d3c0d9
-
Update config.json
Verified signature72defc5 -
Update README.md
Verified signaturef31bc36
-
Delete rng_state_2.pth
Verified signatured623c51 -
Delete rng_state_29.pth
Verified signatureaccf7d9 -
Delete rng_state_34.pth
Verified signature318d278 -
Delete rng_state_5.pth
Verified signature36d7d0b -
Delete rng_state_61.pth
Verified signature694fdc4 -
Delete rng_state_14.pth
Verified signature56ce203 -
Delete rng_state_12.pth
Verified signature36ebcd2 -
Upload model-00001-of-00004.safetensors with huggingface_hub
Verified signature3777d85 -
Upload special_tokens_map.json with huggingface_hub
Verified signature40a78e1 -
Upload training_args.bin with huggingface_hub
Verified signatured0fa1e1 -
Upload model-00004-of-00004.safetensors with huggingface_hub
Verified signature5f70d6c -
Upload tokenizer.json with huggingface_hub
Verified signature61b153e -
Upload config.json with huggingface_hub
Verified signatureb01628f -
Upload generation_config.json with huggingface_hub
Verified signature2abb163 -
Upload added_tokens.json with huggingface_hub
Verified signaturef6f9977 -
Upload model.safetensors.index.json with huggingface_hub
Verified signature204f770 -
Upload trainer_state.json with huggingface_hub
Verified signatureb93f04c -
Upload tokenizer_config.json with huggingface_hub
Verified signaturef53708f -
Upload merges.txt with huggingface_hub
Verified signature6599f07 -
Upload vocab.json with huggingface_hub
Verified signaturee8947a0 -
Upload model-00003-of-00004.safetensors with huggingface_hub
Verified signatured04f166 -
Upload model-00002-of-00004.safetensors with huggingface_hub
Verified signaturecd59f5d -
Upload rng_state_12.pth with huggingface_hub
Verified signature79e2152 -
Upload rng_state_2.pth with huggingface_hub
Verified signature0f726ad -
Upload rng_state_29.pth with huggingface_hub
Verified signature134091c -
Upload rng_state_5.pth with huggingface_hub
Verified signaturef83af75 -
Upload rng_state_61.pth with huggingface_hub
Verified signature0bf97e5 -
Upload rng_state_34.pth with huggingface_hub
Verified signature2c40634 -
Upload rng_state_14.pth with huggingface_hub
Verified signature5536314 -
initial commit
Verified signature5e77684