Instructions to use tencent/Youtu-LLM-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Youtu-LLM-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Youtu-LLM-2B") 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/Youtu-LLM-2B") model = AutoModelForCausalLM.from_pretrained("tencent/Youtu-LLM-2B", 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/Youtu-LLM-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Youtu-LLM-2B" # 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/Youtu-LLM-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Youtu-LLM-2B
- SGLang
How to use tencent/Youtu-LLM-2B 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/Youtu-LLM-2B" \ --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/Youtu-LLM-2B", "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/Youtu-LLM-2B" \ --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/Youtu-LLM-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Youtu-LLM-2B with Docker Model Runner:
docker model run hf.co/tencent/Youtu-LLM-2B
Commit History
-
Upload YoutuForCausalLM
Verified signature2051e28 -
Delete configuration_youtu.py
Verified signature5479c0b -
Delete modeling_youtu.py
Verified signature873aa4e -
Align with HF transformers PR
Verified signaturehttps://github.com/huggingface/transformers/pull/431664cc7312
-
Update README.md (#16)
Verified signature- Update README.md (77068bc2ff4a862b40c23820db363fe5fb71b464)32bca2e
-
update quickstart (#13)
Verified signature- update quickstart (e5583e2e0cfaacdae7833fedb6d790d39a4ff571)108c40a -
Update README.md for transformers' version annotation (#12)
Verified signature- Update README.md for transformers' version annotation (b67514efac5aabf5f714cef096b23b3c60eedfd6)7bc280a
-
Update README.md (#9)
Verified signature- Update README.md (59b40f35f29ad91a9b1088a703290b7dffb850ea)c8a97b9
-
Update LICENSE.txt (#7)
Verified signature- Update LICENSE.txt (8e7f08ce3719e71bd4a9191702696490a8363a4f)5fcbd3a
-
Update README.md
Verified signature6a86e63 -
修改论文引用 (#6)
Verified signature- 修改论文引用 (d8f1086f0ca3a4f63c1d934be1a0ac7bb4b5f7b0) Co-authored-by: endymecy <endymecy@users.noreply.huggingface.co>b743d05
-
Use rsplit properly (#1)
Verified signature- Use rsplit properly (95afe0c798b6191e8e96b9dc285c98f0b73e11e2) Co-authored-by: Sigbjørn Skjæret <CISCai@users.noreply.huggingface.co>946a7c0
-
Update README.md
Verified signature6b16a38 -
Upload readme
TencentCloudADPDevRel4dec568 -
Upload Youtu-LLM-2B model with LFS assets
TencentCloudADPDevRelf800ccd -
initial commit
Verified signature54d2988