Instructions to use tencent/Hunyuan-0.5B-Instruct-AWQ-Int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hunyuan-0.5B-Instruct-AWQ-Int4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hunyuan-0.5B-Instruct-AWQ-Int4") 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-AWQ-Int4") model = AutoModelForCausalLM.from_pretrained("tencent/Hunyuan-0.5B-Instruct-AWQ-Int4") 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-AWQ-Int4 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-AWQ-Int4" # 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-AWQ-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hunyuan-0.5B-Instruct-AWQ-Int4
- SGLang
How to use tencent/Hunyuan-0.5B-Instruct-AWQ-Int4 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-AWQ-Int4" \ --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-AWQ-Int4", "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-AWQ-Int4" \ --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-AWQ-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hunyuan-0.5B-Instruct-AWQ-Int4 with Docker Model Runner:
docker model run hf.co/tencent/Hunyuan-0.5B-Instruct-AWQ-Int4
| { | |
| "model_config": { | |
| "name": "HunyuanDense", | |
| "model_path": "/", | |
| "trust_remote_code": true, | |
| "torch_dtype": "auto", | |
| "device_map": "cpu", | |
| "low_cpu_mem_usage": true, | |
| "use_cache": false | |
| }, | |
| "compression_config": { | |
| "name": "PTQ", | |
| "quantization": { | |
| "name": "int4_awq", | |
| "bits": 4, | |
| "quant_method": { | |
| "weight": "per-group", | |
| "group_size": 128, | |
| "zero_point": true, | |
| "mse_range": false | |
| }, | |
| "quant_helpers": [], | |
| "smooth_alpha": 0.5, | |
| "low_memory": false, | |
| "modules_to_quantize": [], | |
| "zero_point": true, | |
| "mse_range": false, | |
| "ignore_layers": [ | |
| "lm_head", | |
| "model.embed_tokens" | |
| ], | |
| "quant_analyse": false | |
| } | |
| }, | |
| "dataset_config": { | |
| "name": "TextDataset", | |
| "data_path": "./dataset/PTQ_data.jsonl", | |
| "max_seq_length": 4096, | |
| "num_samples": 128, | |
| "batch_size": 1, | |
| "shuffle": false | |
| }, | |
| "global_config": { | |
| "save_path": "/", | |
| "max_seq_length": 4096, | |
| "hidden_size": 1024, | |
| "model_arch_type": "hunyuan_v1_dense", | |
| "deploy_backend": "vllm" | |
| }, | |
| "debug_info": { | |
| "python": "3.10.14 (main, Mar 6 2025, 18:16:47) [GCC 11.4.0]", | |
| "angelslim": { | |
| "name": "angelslim", | |
| "version": "be35620eca8ad4e6bf8263e84cee69d90c7045a4", | |
| "source": "git" | |
| }, | |
| "torch": { | |
| "name": "torch", | |
| "version": "2.7.0", | |
| "source": "pip" | |
| }, | |
| "transformers": { | |
| "name": "transformers", | |
| "version": "4.52.4", | |
| "source": "pip" | |
| }, | |
| "torch_cuda_version": "12.6" | |
| } | |
| } | |