Image-Text-to-Text
Transformers
Safetensors
hy_v4_vl
hunyuan
hy4
Mixture of Experts
multimodal
instruct
conversational
Eval Results
Run this model with HF Jobs
Run tencent/Hy4 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/tencent/Hy4. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tencent/Hy4 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/tencent/Hy4. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/tencent/Hy4. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use tencent/Hy4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tencent/Hy4") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tencent/Hy4") model = AutoModelForMultimodalLM.from_pretrained("tencent/Hy4", 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 = 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hy4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hy4" # 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", "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
- SGLang
How to use tencent/Hy4 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" \ --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", "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" \ --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", "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 with Docker Model Runner:
docker model run hf.co/tencent/Hy4
update
Browse filesFiles changed (2)
- README.md+4-4
- README_CN.md+4-4
29 unmodified lines3031323334353635 unmodified lines72737475767778141 unmodified lines22022122222322422522622722822923029 unmodified lines [](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) [](https://ai.gitcode.com/tencent_hunyuan/Hy4)</div>35 unmodified lines## Model Introduction**Hy4** is a new-generation Mixture-of-Experts (MoE) flagship model developed by the Tencent Hy Team, supporting text, image, and video understanding. The language backbone comprises 770B total parameters, of which 49B are activated per token. It consists of 78 layers, with a standard dense FFN in the first layer and MoE FFNs in the remaining 77 layers. Each MoE layer contains 256 routed experts and 1 shared expert; every token activates the top-8 routed experts along with the shared expert. In addition to the backbone, a 5-layer DFly2 drafter (3.3B parameters) is built in for speculative decoding.On the architecture side, inspired by DeepSeek and GLM, the attention module employs Gated [DeepSeek Sparse Attention](https://arxiv.org/abs/2512.02556) (Gated DSA) with [IndexCache](https://arxiv.org/abs/2603.12201) for cross-layer sparse index reuse. The residual pathway uses [iHC (identity Hyper-Connections)](https://zhuanlan.zhihu.com/p/2010852389670908320) to expand inter-layer information flow. A ViT supports dynamic image resolutions, with an adapter converting image and video frame features into visual tokens for the language model to process alongside text tokens. [DFly2](#dfly2-for-speculative-decoding), a parallel drafter, reuses Hy4's KV cache and sparse indices to support long-context speculative decoding at a low, constant cost.141 unmodified lines## News* We open-source **Hy4**, **Hy4-FP8**, and the pre-trained **Hy4 base** model weights on [Hugging Face](https://huggingface.co/tencent/Hy4), [ModelScope](https://modelscope.cn/models/Tencent-Hunyuan/Hy4), and [GitCode](https://ai.gitcode.com/tencent_hunyuan/Hy4).## Model Links| Model Name | Description | Hugging Face | ModelScope | GitCode ||:---|:---|:---:|:---:|:---:|| Hy4 | Instruct model | [Model](https://huggingface.co/tencent/Hy4) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4) || Hy4-FP8 | FP8 quantized instruct model | [Model](https://huggingface.co/tencent/Hy4-FP8) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4-FP8) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4-FP8) |29 unmodified lines3031323334353635 unmodified lines72737475767778141 unmodified lines22022122222322422522622722822923029 unmodified lines [](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) [](https://ai.gitcode.com/tencent_hunyuan/Hy4)</div>35 unmodified lines## Model Introduction**Hy4** is a new-generation Mixture-of-Experts (MoE) flagship model developed by the Tencent Hy Team, supporting text and image understanding. The language backbone comprises 770B total parameters, of which 49B are activated per token. It consists of 78 layers, with a standard dense FFN in the first layer and MoE FFNs in the remaining 77 layers. Each MoE layer contains 256 routed experts and 1 shared expert; every token activates the top-8 routed experts along with the shared expert. In addition to the backbone, a 5-layer DFly2 drafter (3.3B parameters) is built in for speculative decoding.On the architecture side, inspired by DeepSeek and GLM, the attention module employs Gated [DeepSeek Sparse Attention](https://arxiv.org/abs/2512.02556) (Gated DSA) with [IndexCache](https://arxiv.org/abs/2603.12201) for cross-layer sparse index reuse. The residual pathway uses [iHC (identity Hyper-Connections)](https://zhuanlan.zhihu.com/p/2010852389670908320) to expand inter-layer information flow. A ViT supports dynamic image resolutions, with an adapter converting image and video frame features into visual tokens for the language model to process alongside text tokens. [DFly2](#dfly2-for-speculative-decoding), a parallel drafter, reuses Hy4's KV cache and sparse indices to support long-context speculative decoding at a low, constant cost.141 unmodified lines## News* We open-source **Hy4**, **Hy4-FP8**, and the pre-trained **Hy4 base** model weights on [Hugging Face](https://huggingface.co/tencent/Hy4), [ModelScope](https://modelscope.cn/models/Tencent-Hunyuan/Hy4), and [AtomGit](https://ai.gitcode.com/tencent_hunyuan/Hy4).## Model Links| Model Name | Description | Hugging Face | ModelScope | AtomGit ||:---|:---|:---:|:---:|:---:|| Hy4 | Instruct model | [Model](https://huggingface.co/tencent/Hy4) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4) || Hy4-FP8 | FP8 quantized instruct model | [Model](https://huggingface.co/tencent/Hy4-FP8) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4-FP8) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4-FP8) |
15 unmodified lines1617181920212235 unmodified lines58596061626364139 unmodified lines20420520620720820921021121221321415 unmodified lines [](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) [](https://ai.gitcode.com/tencent_hunyuan/Hy4)</div>35 unmodified lines## 模型介绍**Hy4** 是由腾讯混元团队研发的新一代混合专家(MoE)旗舰模型,支持文本、图像和视频理解。语言模型主干总参数量 770B,每个 token 激活 49B,共包含 78 层,第一层采用标准 FFN,其余 77 层均为 MoE 结构,每层包含 256 个路由专家与 1 个共享专家,每个 token 激活 top-8 路由专家及共享专家。主干之外内置 5 层 DFly2 草稿模型(参数量 3.3B)以支持投机解码。在架构层面,受到 DeepSeek 和 GLM 的启发,注意力侧采用 Gated [DeepSeek Sparse Attention](https://arxiv.org/abs/2512.02556)(Gated DSA),并引入 [IndexCache](https://arxiv.org/abs/2603.12201) 跨层复用稀疏索引,残差侧采用 [iHC (identity Hyper-Connections)](https://zhuanlan.zhihu.com/p/2010852389670908320) 扩展层间信息通路。视觉侧采用支持动态分辨率的 ViT,通过适配器将图像和视频帧的特征转换为视觉 token,与文本 token 一同输入语言模型。并行草稿模型 [DFly2](#dfly2-投机解码) 直接复用 Hy4 的 KV cache 与稀疏索引,以固定的低开销支持长上下文投机解码。139 unmodified lines## 新闻* 我们在 [Hugging Face](https://huggingface.co/tencent/Hy4)、[ModelScope](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) 和 [GitCode](https://ai.gitcode.com/tencent_hunyuan/Hy4) 开源 **Hy4**、**Hy4-FP8** 和预训练模型 **Hy4 base** 的权重。## 模型链接| 模型名 | 简介 | Hugging Face | ModelScope | GitCode ||:---|:---|:---:|:---:|:---:|| Hy4 | Instruct 模型 | [Model](https://huggingface.co/tencent/Hy4) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4) || Hy4-FP8 | FP8 量化 Instruct 模型 | [Model](https://huggingface.co/tencent/Hy4-FP8) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4-FP8) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4-FP8) |15 unmodified lines1617181920212235 unmodified lines58596061626364139 unmodified lines20420520620720820921021121221321415 unmodified lines [](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) [](https://ai.gitcode.com/tencent_hunyuan/Hy4)</div>35 unmodified lines## 模型介绍**Hy4** 是由腾讯混元团队研发的新一代混合专家(MoE)旗舰模型,支持文本和图像理解。语言模型主干总参数量 770B,每个 token 激活 49B,共包含 78 层,第一层采用标准 FFN,其余 77 层均为 MoE 结构,每层包含 256 个路由专家与 1 个共享专家,每个 token 激活 top-8 路由专家及共享专家。主干之外内置 5 层 DFly2 草稿模型(参数量 3.3B)以支持投机解码。在架构层面,受到 DeepSeek 和 GLM 的启发,注意力侧采用 Gated [DeepSeek Sparse Attention](https://arxiv.org/abs/2512.02556)(Gated DSA),并引入 [IndexCache](https://arxiv.org/abs/2603.12201) 跨层复用稀疏索引,残差侧采用 [iHC (identity Hyper-Connections)](https://zhuanlan.zhihu.com/p/2010852389670908320) 扩展层间信息通路。视觉侧采用支持动态分辨率的 ViT,通过适配器将图像和视频帧的特征转换为视觉 token,与文本 token 一同输入语言模型。并行草稿模型 [DFly2](#dfly2-投机解码) 直接复用 Hy4 的 KV cache 与稀疏索引,以固定的低开销支持长上下文投机解码。139 unmodified lines## 新闻* 我们在 [Hugging Face](https://huggingface.co/tencent/Hy4)、[ModelScope](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) 和 [AtomGit](https://ai.gitcode.com/tencent_hunyuan/Hy4) 开源 **Hy4**、**Hy4-FP8** 和预训练模型 **Hy4 base** 的权重。## 模型链接| 模型名 | 简介 | Hugging Face | ModelScope | AtomGit ||:---|:---|:---:|:---:|:---:|| Hy4 | Instruct 模型 | [Model](https://huggingface.co/tencent/Hy4) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4) || Hy4-FP8 | FP8 量化 Instruct 模型 | [Model](https://huggingface.co/tencent/Hy4-FP8) | [Model](https://modelscope.cn/models/Tencent-Hunyuan/Hy4-FP8) | [Model](https://ai.gitcode.com/tencent_hunyuan/Hy4-FP8) |
README.md+4-4
README_CN.md+4-4