Instructions to use zai-org/chatglm-6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/chatglm-6b with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zai-org/chatglm-6b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Support single integer or empty list as input to decode
#7
by peakji - opened
- tokenization_chatglm.py +4 -0
tokenization_chatglm.py
CHANGED
|
@@ -264,6 +264,10 @@ class ChatGLMTokenizer(PreTrainedTokenizer):
|
|
| 264 |
spaces_between_special_tokens: bool = True,
|
| 265 |
**kwargs
|
| 266 |
) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
if isinstance(token_ids[0], list):
|
| 268 |
tokens = []
|
| 269 |
for single_token_ids in token_ids:
|
|
|
|
| 264 |
spaces_between_special_tokens: bool = True,
|
| 265 |
**kwargs
|
| 266 |
) -> str:
|
| 267 |
+
if not isinstance(token_ids, list):
|
| 268 |
+
token_ids = [token_ids]
|
| 269 |
+
if len(token_ids) == 0:
|
| 270 |
+
return ""
|
| 271 |
if isinstance(token_ids[0], list):
|
| 272 |
tokens = []
|
| 273 |
for single_token_ids in token_ids:
|