Instructions to use 01-ai/Yi-1.5-34B-Chat-16K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 01-ai/Yi-1.5-34B-Chat-16K with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="01-ai/Yi-1.5-34B-Chat-16K") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-1.5-34B-Chat-16K") model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-1.5-34B-Chat-16K", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 01-ai/Yi-1.5-34B-Chat-16K with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "01-ai/Yi-1.5-34B-Chat-16K" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "01-ai/Yi-1.5-34B-Chat-16K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/01-ai/Yi-1.5-34B-Chat-16K
- SGLang
How to use 01-ai/Yi-1.5-34B-Chat-16K 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 "01-ai/Yi-1.5-34B-Chat-16K" \ --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": "01-ai/Yi-1.5-34B-Chat-16K", "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 "01-ai/Yi-1.5-34B-Chat-16K" \ --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": "01-ai/Yi-1.5-34B-Chat-16K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 01-ai/Yi-1.5-34B-Chat-16K with Docker Model Runner:
docker model run hf.co/01-ai/Yi-1.5-34B-Chat-16K
File size: 1,384 Bytes
f061b2b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 19226f96f27e0ec5061c2ef14fc9fa21 config.json
b392e4e42890d4d6e0bdaf1eb7d51f54 generation_config.json
e966336222cc3798839a2c14ee52ded3 model-00001-of-00015.safetensors
d9abf0ed13a761b56389c1f64cfa8af8 model-00002-of-00015.safetensors
5891d8f9b2d6f21e5a70a6dd02194d8b model-00003-of-00015.safetensors
58f87a1102f55a6d1bc5392410f57d4b model-00004-of-00015.safetensors
2cf0a1bdfb2306ba56591310c5e9adc1 model-00005-of-00015.safetensors
fcb07f4e7322ffca22a88838b2c09e3f model-00006-of-00015.safetensors
7cf6204b4972ca887f59e6c12b5f8b3f model-00007-of-00015.safetensors
42ce6e5dc891c0b0d7ed17f9564e7de0 model-00008-of-00015.safetensors
42e54f5651033524518061a1c547860e model-00009-of-00015.safetensors
08dc7740d2017bcdda971199b6712e86 model-00010-of-00015.safetensors
8f1c7dac35381a6485b68371469eba03 model-00011-of-00015.safetensors
5d5e1409307022f82227c23986e29972 model-00012-of-00015.safetensors
fd9434acf10e830a6a7a94cb68725f8b model-00013-of-00015.safetensors
2816ee3f35480e37e02649282988d991 model-00014-of-00015.safetensors
1f738d1a1b9409a9cc8f5eaa7a60d25e model-00015-of-00015.safetensors
d24846f52ccec5bbc266022ad9b17efc model.safetensors.index.json
154a77922391b45682115a35a4fa1d85 special_tokens_map.json
431e5b229fb9efa8c11ccc673036569d tokenizer.json
291724ef50f729e45d68f474a7755bbc tokenizer.model
60a1ba053a1caeb71933895ae0a846bd tokenizer_config.json
|