Text Generation
Transformers
Safetensors
hy_v4
hunyuan
hy4
Mixture of Experts
conversational
Eval Results
Instructions to use tencent/Hy4-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy4-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hy4-preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hy4-preview") model = AutoModelForCausalLM.from_pretrained("tencent/Hy4-preview", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] 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]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hy4-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hy4-preview" # 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-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hy4-preview
- SGLang
How to use tencent/Hy4-preview 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-preview" \ --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-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-preview" \ --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-preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hy4-preview with Docker Model Runner:
docker model run hf.co/tencent/Hy4-preview
update
Browse files- README.md +2 -2
- README_CN.md +2 -2
README.md
CHANGED
|
@@ -42,7 +42,7 @@ tags:
|
|
| 42 |
|
| 43 |
- [Model Introduction](#model-introduction)
|
| 44 |
- [A New Flagship Generation](#a-new-flagship-generation)
|
| 45 |
-
- [Built for
|
| 46 |
- [Benchmark Appendix](#benchmark-appendix)
|
| 47 |
- [Known Limitations](#known-limitations)
|
| 48 |
- [News](#news)
|
|
@@ -98,7 +98,7 @@ We scaled Hy4 preview on three fronts: model size, context length, and training
|
|
| 98 |
<img src="assets/benchmark.jpg" width="100%"/>
|
| 99 |
</p>
|
| 100 |
|
| 101 |
-
## Built for
|
| 102 |
|
| 103 |
We partnered with top experts inside Tencent — such as software engineers, game developers, finance analysts, and security experts — and built training data around the work they ship. The result is a model that gets meaningfully further on the tasks these teams run every day:
|
| 104 |
|
|
|
|
| 42 |
|
| 43 |
- [Model Introduction](#model-introduction)
|
| 44 |
- [A New Flagship Generation](#a-new-flagship-generation)
|
| 45 |
+
- [Built for Productivity](#built-for-productivity)
|
| 46 |
- [Benchmark Appendix](#benchmark-appendix)
|
| 47 |
- [Known Limitations](#known-limitations)
|
| 48 |
- [News](#news)
|
|
|
|
| 98 |
<img src="assets/benchmark.jpg" width="100%"/>
|
| 99 |
</p>
|
| 100 |
|
| 101 |
+
## Built for Productivity
|
| 102 |
|
| 103 |
We partnered with top experts inside Tencent — such as software engineers, game developers, finance analysts, and security experts — and built training data around the work they ship. The result is a model that gets meaningfully further on the tasks these teams run every day:
|
| 104 |
|
README_CN.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
| 32 |
|
| 33 |
- [模型介绍](#模型介绍)
|
| 34 |
- [新一代旗舰模型](#新一代旗舰模型)
|
| 35 |
-
- [为
|
| 36 |
- [Benchmark 附录](#benchmark-附录)
|
| 37 |
- [已知局限](#已知局限)
|
| 38 |
- [新闻](#新闻)
|
|
@@ -88,7 +88,7 @@ Hy4 preview 在模型尺寸、上下文长度、数据规模上都进行了显
|
|
| 88 |
<img src="assets/benchmark.jpg" width="100%"/>
|
| 89 |
</p>
|
| 90 |
|
| 91 |
-
## 为
|
| 92 |
|
| 93 |
通过与腾讯内部软件工程师、游戏开发者、金融分析师、安全专家等各领域顶尖专家的高质量数据共建,Hy4 preview 在各类真实生产力任务上取得显著进步:
|
| 94 |
|
|
|
|
| 32 |
|
| 33 |
- [模型介绍](#模型介绍)
|
| 34 |
- [新一代旗舰模型](#新一代旗舰模型)
|
| 35 |
+
- [为生产力而生](#为生产力而生)
|
| 36 |
- [Benchmark 附录](#benchmark-附录)
|
| 37 |
- [已知局限](#已知局限)
|
| 38 |
- [新闻](#新闻)
|
|
|
|
| 88 |
<img src="assets/benchmark.jpg" width="100%"/>
|
| 89 |
</p>
|
| 90 |
|
| 91 |
+
## 为生产力而生
|
| 92 |
|
| 93 |
通过与腾讯内部软件工程师、游戏开发者、金融分析师、安全专家等各领域顶尖专家的高质量数据共建,Hy4 preview 在各类真实生产力任务上取得显著进步:
|
| 94 |
|