Instructions to use bytedance-research/ChatTS-14B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bytedance-research/ChatTS-14B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bytedance-research/ChatTS-14B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("bytedance-research/ChatTS-14B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bytedance-research/ChatTS-14B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bytedance-research/ChatTS-14B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bytedance-research/ChatTS-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bytedance-research/ChatTS-14B
- SGLang
How to use bytedance-research/ChatTS-14B 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 "bytedance-research/ChatTS-14B" \ --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": "bytedance-research/ChatTS-14B", "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 "bytedance-research/ChatTS-14B" \ --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": "bytedance-research/ChatTS-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bytedance-research/ChatTS-14B with Docker Model Runner:
docker model run hf.co/bytedance-research/ChatTS-14B
Sample code fails
#4
by csabakecskemeti - opened
Sample code generate fails:
File ~/.cache/huggingface/modules/transformers_modules/bytedance-research/ChatTS-14B/b54f0d8e86d15bc7168c602c24203c480e8aee02/modeling_qwen2.py:1509, in Qwen2TSForCausalLM.prepare_inputs_for_generation(self, input_ids, past_key_values, attention_mask, inputs_embeds, timeseries, **kwargs)
1507 cache_length = past_key_values.get_seq_length()
1508 past_length = past_key_values.seen_tokens
-> 1509 max_cache_length = past_key_values.get_max_length()
1510 else:
1511 cache_length = past_length = past_key_values[0][0].shape[2]
AttributeError: 'DynamicCache' object has no attribute 'get_max_length'
I'm on latest : transformers 4.51.3
In fact if I've downgraded transformers to the version available when the modeling_qwen2.py file has been uploadedtransformers==4.47.1 the code has worked!
Also suggesting to update the sample code to use the hf_model_id instead of the checkpoint folder, and use device_map = "auto"
hf_model = "bytedance-research/ChatTS-14B"
# Load the model, tokenizer and processor
model = AutoModelForCausalLM.from_pretrained(hf_model, trust_remote_code=True, device_map="auto", torch_dtype='float16')
tokenizer = AutoTokenizer.from_pretrained(hf_model, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(hf_model, trust_remote_code=True, tokenizer=tokenizer)
Thank you for pointing out this issue! We've already updated modeling_qwen2.py. You can test it in the latest version of transformers.
xiezhe24 changed discussion status to closed