Instructions to use taide/TAIDE-LX-7B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use taide/TAIDE-LX-7B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="taide/TAIDE-LX-7B-Chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("taide/TAIDE-LX-7B-Chat") model = AutoModelForCausalLM.from_pretrained("taide/TAIDE-LX-7B-Chat") 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 taide/TAIDE-LX-7B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "taide/TAIDE-LX-7B-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "taide/TAIDE-LX-7B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/taide/TAIDE-LX-7B-Chat
- SGLang
How to use taide/TAIDE-LX-7B-Chat 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 "taide/TAIDE-LX-7B-Chat" \ --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": "taide/TAIDE-LX-7B-Chat", "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 "taide/TAIDE-LX-7B-Chat" \ --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": "taide/TAIDE-LX-7B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use taide/TAIDE-LX-7B-Chat with Docker Model Runner:
docker model run hf.co/taide/TAIDE-LX-7B-Chat
請問TAIDE model相關參數設定問題?
請問TAIDE model的上下文context size上限是多少tokens? 每次問答的輸入輸出上限一樣是 4096 tokens?
TAIDE 可以或是需要設定這類型的參數嗎? Temperature、Top-K、Top-P
如果要的話,數字預設多少是效果較好的?
謝謝
您好
每次輸入和輸出總和最長是 4096 tokens。generation config 我們在測試時一律使用 greedy,當然您也可以調整 generation config 來取得更好效果。
Best regards,
TAIDE
您好
每次輸入和輸出總和最長是 4096 tokens。generation config 我們在測試時一律使用 greedy,當然您也可以調整 generation config 來取得更好效果。
Best regards,
TAIDE
謝謝您 那TAIDE model的上下文context size上限是多少tokens?
如果想輸入長文本文獻資料做summary整理 如: 會談對話、小說文字、文獻期刊、病歷資料等 做摘要整理的話
會限制說不能超過多少tokens嗎? 訓練集資料要怎麼設計比較好呢? 謝謝
您好
我們在訓練 TAIDE 模型時使用的 Context Length 與原版 LLaMA 2 模型一樣是 4096
因此在不更改任何設定或額外訓練的情況下,上限就是 4096
但如果您有需要更長的長度可以考慮使用 RoPE Scaling 的技術,transformers 有原生的實驗性支援
https://huggingface.co/docs/transformers/main/en/model_doc/llama#transformers.LlamaConfig.rope_scaling
https://github.com/huggingface/transformers/blob/fbb41cd4209c00671fef583a39db2f608fcd7098/src/transformers/models/llama/modeling_llama.py#L293-L318
其中 Dynamic NTK scaling 的方式能夠在不做任何額外訓練的情況下有不錯的長度擴展能力
您好:
context 問題如 @ShinoharaHare 哥所說。至於FT資料集的設計,我們可以提供幾個對於 general chat ability 有幫助的方向,您可以參考看看:
- FT 資料需要足夠 diverse (topic / task 等)。
- FT 資料如果品質夠好,用少量資料就可以有很好效果。
- CoT 對於FT結果很有幫助。
以下是幾篇相關論文:
https://arxiv.org/abs/2307.08701
https://arxiv.org/abs/2305.11206
Best regards,
TAIDE
您好:
context 問題如 @ShinoharaHare 哥所說。至於FT資料集的設計,我們可以提供幾個對於 general chat ability 有幫助的方向,您可以參考看看:
- FT 資料需要足夠 diverse (topic / task 等)。
- FT 資料如果品質夠好,用少量資料就可以有很好效果。
- CoT 對於FT結果很有幫助。
以下是幾篇相關論文:
https://arxiv.org/abs/2307.08701
https://arxiv.org/abs/2305.11206Best regards,
TAIDE
謝謝回復 不過本身是這塊領域的初學者 很多專業術語看不懂,目前只是用GPT4all介面測試TAIDE 而已
所以TAIDE 目前context就只能4096個token,類似chatgpt 一個對話channel的上限就這些內容嗎?
還想不到說怎麼用類似用python來用OpenAI API的方式