Instructions to use tencent/Hunyuan-4B-Instruct-AWQ-Int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hunyuan-4B-Instruct-AWQ-Int4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hunyuan-4B-Instruct-AWQ-Int4") 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/Hunyuan-4B-Instruct-AWQ-Int4") model = AutoModelForCausalLM.from_pretrained("tencent/Hunyuan-4B-Instruct-AWQ-Int4", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hunyuan-4B-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-4B-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-4B-Instruct-AWQ-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hunyuan-4B-Instruct-AWQ-Int4
- SGLang
How to use tencent/Hunyuan-4B-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-4B-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-4B-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-4B-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-4B-Instruct-AWQ-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hunyuan-4B-Instruct-AWQ-Int4 with Docker Model Runner:
docker model run hf.co/tencent/Hunyuan-4B-Instruct-AWQ-Int4
Commit History
-
Update README.md
Verified signature7800436
-
Upload README_CN.md with huggingface_hub
Verified signatureaab772e -
Upload README.md with huggingface_hub
Verified signaturefb2af98 -
Upload README_CN.md with huggingface_hub
Verified signature237a16a -
Upload README.md with huggingface_hub
Verified signature73ae6f8 -
Upload tokenizer_config.json with huggingface_hub
Verified signaturea411a41
-
Upload LICENSE with huggingface_hub
Verified signatureda3b0c0
-
Update README.md (#4)
Verified signature- Update README.md (20b4e0ecc88f7fa025300f4e20e1f50a6cd00d55) Co-authored-by: woodchen <woodchen7@users.noreply.huggingface.co>6e3d0d2 -
Update README.md
Verified signature4c6f55a -
Update README.md (#3)
Verified signature- Update README.md (0091ad458d6cd12b866c19b45acf41ebafc18fb8) Co-authored-by: woodchen <woodchen7@users.noreply.huggingface.co>8574b57 -
Update README.md (#2)
Verified signature- Update README.md (a777c857be781c225f5e5c9c7ef81902d05c0051) Co-authored-by: woodchen <woodchen7@users.noreply.huggingface.co>d35e750 -
Update README.md (#1)
Verified signature- Update README.md (dd6c85f7288ca2859d4ce889404c253d66dc80db) Co-authored-by: woodchen <woodchen7@users.noreply.huggingface.co>226c818 -
Update README.md
Verified signaturef1f55ba -
Update README.md
Verified signature611c19e -
Update README.md
Verified signature2255cbd -
Upload tokenizer_config.json with huggingface_hub
Verified signaturef6eb5bb -
Upload requirements.txt with huggingface_hub
Verified signaturef796758 -
Upload README_CN.md with huggingface_hub
Verified signature24cd1c6 -
Upload README.md with huggingface_hub
Verified signaturef567874 -
Upload Notice.txt with huggingface_hub
Verified signature03f8953 -
Upload LICENSE.txt with huggingface_hub
Verified signature6efdd0f
-
Upload tokenizer_config.json with huggingface_hub
Verified signature70f9712 -
Upload tokenizer.json with huggingface_hub
Verified signaturee0fa563 -
Upload special_tokens_map.json with huggingface_hub
Verified signature63986f4 -
Upload model.safetensors with huggingface_hub
Verified signatureadcbef0 -
Upload config.json with huggingface_hub
Verified signature66bbe07 -
Upload chat_template.jinja with huggingface_hub
Verified signature8c1a452 -
Upload angelslim_config.json with huggingface_hub
Verified signature069aff8
-
initial commit
Verified signaturee79e068