Instructions to use tencent/Hunyuan-0.5B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hunyuan-0.5B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hunyuan-0.5B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hunyuan-0.5B-Instruct") model = AutoModelForCausalLM.from_pretrained("tencent/Hunyuan-0.5B-Instruct") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use tencent/Hunyuan-0.5B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hunyuan-0.5B-Instruct" # 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/Hunyuan-0.5B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hunyuan-0.5B-Instruct
- SGLang
How to use tencent/Hunyuan-0.5B-Instruct 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/Hunyuan-0.5B-Instruct" \ --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/Hunyuan-0.5B-Instruct", "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/Hunyuan-0.5B-Instruct" \ --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/Hunyuan-0.5B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hunyuan-0.5B-Instruct with Docker Model Runner:
docker model run hf.co/tencent/Hunyuan-0.5B-Instruct
Update README.md
#2
by woodchen7 - opened
README.md
CHANGED
|
@@ -5,20 +5,22 @@
|
|
| 5 |
</p><p></p>
|
| 6 |
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
<p align="center">
|
| 10 |
-
|
| 11 |
-
🖥️ <a href="https://hunyuan.tencent.com" style="color: red;"><b>Official Website</b></a> |
|
| 12 |
🕖 <a href="https://cloud.tencent.com/product/hunyuan"><b>HunyuanAPI</b></a> |
|
| 13 |
-
🕹️ <a href="https://hunyuan.tencent.com/"><b>Demo</b></a>
|
| 14 |
-
🤖 <a href="https://www.modelscope.cn/models/Tencent-Hunyuan/Hunyuan-0.5B-Instruct"><b>ModelScope</b></a>
|
| 15 |
</p>
|
| 16 |
|
| 17 |
-
|
| 18 |
<p align="center">
|
| 19 |
-
<a href="https://github.com/Tencent-Hunyuan/Hunyuan-
|
| 20 |
-
<a href="https://cnb.cool/tencent/hunyuan/Hunyuan-
|
| 21 |
-
<a href="https://github.com/Tencent-Hunyuan/Hunyuan-
|
| 22 |
<a href="https://raw.githubusercontent.com/Tencent-Hunyuan/Hunyuan-A13B/main/assets/1751881231452.jpg"><b>WeChat</b></a> |
|
| 23 |
<a href="https://discord.gg/bsPcMEtV7v"><b>Discord</b></a>
|
| 24 |
</p>
|
|
|
|
| 5 |
</p><p></p>
|
| 6 |
|
| 7 |
|
| 8 |
+
<p align="center">
|
| 9 |
+
🤗 <a href="https://huggingface.co/tencent/"><b>HuggingFace</b></a> |
|
| 10 |
+
🤖 <a href="https://modelscope.cn/models/Tencent-Hunyuan/Hunyuan-A13B-Instruct"><b>ModelScope</b></a> |
|
| 11 |
+
🪡 <a href="https://github.com/Tencent/AngelSlim/tree/main"><b>AngelSlim</b></a>
|
| 12 |
+
</p>
|
| 13 |
|
| 14 |
<p align="center">
|
| 15 |
+
🖥️ <a href="https://hunyuan.tencent.com" style="color: red;"><b>Official Website</b></a> |
|
|
|
|
| 16 |
🕖 <a href="https://cloud.tencent.com/product/hunyuan"><b>HunyuanAPI</b></a> |
|
| 17 |
+
🕹️ <a href="https://hunyuan.tencent.com/"><b>Demo</b></a>
|
|
|
|
| 18 |
</p>
|
| 19 |
|
|
|
|
| 20 |
<p align="center">
|
| 21 |
+
<a href="https://github.com/Tencent-Hunyuan/Hunyuan-7B"><b>GITHUB</b></a> |
|
| 22 |
+
<a href="https://cnb.cool/tencent/hunyuan/Hunyuan-7B"><b>cnb.cool</b></a> |
|
| 23 |
+
<a href="https://github.com/Tencent-Hunyuan/Hunyuan-7B/blob/main/LICENSE"><b>LICENSE</b></a> |
|
| 24 |
<a href="https://raw.githubusercontent.com/Tencent-Hunyuan/Hunyuan-A13B/main/assets/1751881231452.jpg"><b>WeChat</b></a> |
|
| 25 |
<a href="https://discord.gg/bsPcMEtV7v"><b>Discord</b></a>
|
| 26 |
</p>
|