Image-Text-to-Text
Transformers
Safetensors
Chinese
English
qwen2_5_vl
document-parsing
document-understanding
document-intelligence
ocr
layout-analysis
table-extraction
formula-recognition
code-extraction
multimodal
vision-language-model
conversational
text-generation-inference
Instructions to use ByteDance/Dolphin-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ByteDance/Dolphin-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ByteDance/Dolphin-v2") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ByteDance/Dolphin-v2") model = AutoModelForMultimodalLM.from_pretrained("ByteDance/Dolphin-v2") 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 = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ByteDance/Dolphin-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ByteDance/Dolphin-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ByteDance/Dolphin-v2", "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/ByteDance/Dolphin-v2
- SGLang
How to use ByteDance/Dolphin-v2 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 "ByteDance/Dolphin-v2" \ --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": "ByteDance/Dolphin-v2", "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 "ByteDance/Dolphin-v2" \ --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": "ByteDance/Dolphin-v2", "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 ByteDance/Dolphin-v2 with Docker Model Runner:
docker model run hf.co/ByteDance/Dolphin-v2
| 2025-08-11 16:49:45,900:14501(0x7f3fe865a580):ZOO_INFO@log_env@1104: Client environment:zookeeper.version=zookeeper C client 3.5.9 | |
| 2025-08-11 16:49:45,900:14501(0x7f3fe865a580):ZOO_INFO@log_env@1108: Client environment:host.name=mlxlabifld9weh65f97e88-20240319120112-kivju8-master | |
| 2025-08-11 16:49:45,900:14501(0x7f3fe865a580):ZOO_INFO@log_env@1115: Client environment:os.name=Linux | |
| 2025-08-11 16:49:45,900:14501(0x7f3fe865a580):ZOO_INFO@log_env@1116: Client environment:os.arch=5.10.135 | |
| 2025-08-11 16:49:45,900:14501(0x7f3fe865a580):ZOO_INFO@log_env@1117: Client environment:os.version=#1 SMP Tue Sep 5 15:13:05 CST 2023 | |
| 2025-08-11 16:49:45,902:14501(0x7f3fe865a580):ZOO_INFO@log_env@1125: Client environment:user.name=(null) | |
| 2025-08-11 16:49:45,904:14501(0x7f3fe865a580):ZOO_INFO@log_env@1133: Client environment:user.home=/root | |
| 2025-08-11 16:49:45,904:14501(0x7f3fe865a580):ZOO_INFO@log_env@1145: Client environment:user.dir=/mnt/bn/nas-data-block-ocr/checkpoints/qwen2.5_vl_sw/dolphinv2_qwen25_vl_3b_sft_read_absord_aug/dolphin_v2 | |
| 2025-08-11 16:49:45,904:14501(0x7f3fe865a580):ZOO_INFO@zookeeper_init_internal@1188: Initiating client connection, host=fdbd:dc05:0:33::22:2181,10.160.27.133:2181,10.160.23.141:2181,10.160.24.22:2181,fdbd:dc05:0:47::133:2181,fdbd:dc05:0:31::141:2181,10.160.20.162:2181,fdbd:dc05:0:19::155:2181,10.160.20.155:2181,fdbd:dc05:0:19::162:2181 sessionTimeout=6000 watcher=0x7f3fec522c20 sessionId=0 sessionPasswd=<null> context=0x7f3fe81c1080 flags=0 | |
| 2025-08-11 16:49:45,907:14501(0x7f3fcc56f700):ZOO_INFO@check_events@2477: initiated connection to server | |
| 2025-08-11 16:49:45,909:14501(0x7f3fcc56f700):ZOO_INFO@check_events@2529: session establishment complete on server | |
| 2025-08-11 16:50:31,076:14501(0x7f3fe865a580):ZOO_INFO@zookeeper_close@3357: Freeing zookeeper resources for sessionId=0x64000000423a3a00 | |
| 2025-08-26 17:37:57,963:19417(0x7f37b95df580):ZOO_INFO@log_env@1104: Client environment:zookeeper.version=zookeeper C client 3.5.9 | |
| 2025-08-26 17:37:57,963:19417(0x7f37b95df580):ZOO_INFO@log_env@1108: Client environment:host.name=mlxlabifld9weh65f97e88-20240319120112-kivju8-master | |
| 2025-08-26 17:37:57,963:19417(0x7f37b95df580):ZOO_INFO@log_env@1115: Client environment:os.name=Linux | |
| 2025-08-26 17:37:57,963:19417(0x7f37b95df580):ZOO_INFO@log_env@1116: Client environment:os.arch=5.10.135 | |
| 2025-08-26 17:37:57,963:19417(0x7f37b95df580):ZOO_INFO@log_env@1117: Client environment:os.version=#1 SMP Tue Sep 5 15:13:05 CST 2023 | |
| 2025-08-26 17:37:57,967:19417(0x7f37b95df580):ZOO_INFO@log_env@1125: Client environment:user.name=(null) | |
| 2025-08-26 17:37:57,968:19417(0x7f37b95df580):ZOO_INFO@log_env@1133: Client environment:user.home=/root | |
| 2025-08-26 17:37:57,968:19417(0x7f37b95df580):ZOO_INFO@log_env@1145: Client environment:user.dir=/mnt/bn/nas-data-block-ocr/checkpoints/qwen2.5_vl_sw/dolphinv2_qwen25_vl_3b_sft_read_absord_aug_20.4_save/dolphin_v2 | |
| 2025-08-26 17:37:57,968:19417(0x7f37b95df580):ZOO_INFO@zookeeper_init_internal@1188: Initiating client connection, host=fdbd:dc05:0:47::133:2181,fdbd:dc05:0:33::22:2181,10.160.24.22:2181,10.160.20.162:2181,fdbd:dc05:0:19::162:2181,fdbd:dc05:0:31::141:2181,10.160.23.141:2181,10.160.20.155:2181,10.160.27.133:2181,fdbd:dc05:0:19::155:2181 sessionTimeout=6000 watcher=0x7f37bd4a7c20 sessionId=0 sessionPasswd=<null> context=0x7f37b91c1080 flags=0 | |
| 2025-08-26 17:37:57,971:19417(0x7f379d76f700):ZOO_INFO@check_events@2477: initiated connection to server | |
| 2025-08-26 17:37:57,974:19417(0x7f379d76f700):ZOO_INFO@check_events@2529: session establishment complete on server | |
| 2025-08-26 17:38:06,170:19417(0x7f37b95df580):ZOO_INFO@zookeeper_close@3357: Freeing zookeeper resources for sessionId=0x6802513807af071c | |