Image-Text-to-Text
Transformers
Safetensors
hy_v4_flash
text-generation
hunyuan
hy4-flash
Mixture of Experts
multimodal
instruct
conversational
Instructions to use tencent/Hy4-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy4-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tencent/Hy4-flash") 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 AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("tencent/Hy4-flash", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hy4-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hy4-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/Hy4-flash", "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/tencent/Hy4-flash
- SGLang
How to use tencent/Hy4-flash 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 "tencent/Hy4-flash" \ --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": "tencent/Hy4-flash", "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 "tencent/Hy4-flash" \ --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": "tencent/Hy4-flash", "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 tencent/Hy4-flash with Docker Model Runner:
docker model run hf.co/tencent/Hy4-flash
Download finetune/data/example_vl_data.jsonl from tencent/Hy4-flash: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/tencent/Hy4-flash/resolve/main/finetune/data/example_vl_data.jsonl
- Command line
-
hf download hf://tencent/Hy4-flash/finetune/data/example_vl_data.jsonl
-
curl -L -o example_vl_data.jsonl https://huggingface.co/tencent/Hy4-flash/resolve/main/finetune/data/example_vl_data.jsonl
1.54 kB
| {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "<image>Please describe this image in detail."}, {"role": "assistant", "content": "The image shows a beautiful sunset over the ocean. The sky is painted in shades of orange, pink, and purple, with wispy clouds catching the last rays of sunlight. The calm water reflects the vibrant colors, creating a mirror-like effect on the surface."}], "images": ["test_images/sunset.jpg"]} | |
| {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "<image>What objects can you see in this picture?"}, {"role": "assistant", "content": "In this picture, I can see a wooden desk with a laptop computer on it, a coffee mug to the right side, and a small potted plant near the window. There are also some books stacked on the left corner of the desk."}], "images": ["test_images/desk.jpg"]} | |
| {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "<video>Please describe what is happening in this video."}, {"role": "assistant", "content": "The video shows a cat playing with a ball of yarn on a hardwood floor. The cat bats the yarn around with its paws, occasionally pouncing on it and rolling over."}], "videos": ["test_videos/cat.mp4"]} | |
| {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}, {"role": "assistant", "content": "The capital of France is Paris."}]} | |