Instructions to use zai-org/chatglm3-6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/chatglm3-6b with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zai-org/chatglm3-6b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
對tokenizer增加special tokens使其能被.apply_chat_template正確轉換
#36
by p208p2002 - opened
作者您好,之前為chatglm3添加chat_template後發現,使用tokenizer.apply_chat_template轉換成input_ids時會因為tokenizer不認識special token而導致錯誤的轉換結果,因此提出此PR進行修正。
詳細比較與修改請參閱gist:
https://gist.github.com/p208p2002/adf1d4235b9567227d01315beb4b210e
此PR包含 :
- 對
tokenizer增加四個special token ,使他們能夠被正確轉換。
tokenizer.add_tokens("<|user|>")
tokenizer.add_tokens("<|assistant|>")
tokenizer.add_tokens("[gMASK]")
tokenizer.add_tokens("sop")
- 移除
chat_template中額外空白
貢獻:
此PR能夠使 chatglm3 的 tokenizer 正確支援 tokenizer.apply_chat_template方法。
ZHANGYUXUAN-zR changed pull request status to merged
"THUDM/chatglm3-6b--"是否是必要的?此修改影响大量离线使用的使用者。
https://huggingface.co/THUDM/chatglm3-6b/discussions/39
"auto_map": {
"AutoTokenizer": [
"THUDM/chatglm3-6b--tokenization_chatglm.ChatGLMTokenizer",
null
]