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)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("tencent/Hy4-preview", device_map="auto") - 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
Split speculative-decoding flags onto separate lines
Browse files
README.md
CHANGED
|
@@ -202,7 +202,9 @@ docker run --gpus all --ipc=host -p 8000:8000 lmsysorg/sglang:hy4-preview \
|
|
| 202 |
--tp-size 8 \
|
| 203 |
--reasoning-parser auto --tool-call-parser auto \
|
| 204 |
--speculative-algorithm NEXTN \
|
| 205 |
-
--speculative-num-steps 3
|
|
|
|
|
|
|
| 206 |
--served-model-name hy4-preview \
|
| 207 |
--port 8000
|
| 208 |
```
|
|
|
|
| 202 |
--tp-size 8 \
|
| 203 |
--reasoning-parser auto --tool-call-parser auto \
|
| 204 |
--speculative-algorithm NEXTN \
|
| 205 |
+
--speculative-num-steps 3 \
|
| 206 |
+
--speculative-eagle-topk 1 \
|
| 207 |
+
--speculative-num-draft-tokens 4 \
|
| 208 |
--served-model-name hy4-preview \
|
| 209 |
--port 8000
|
| 210 |
```
|