New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chatglm2 support #2906
Comments
on tokenization_chatglm.py line:78 add self._eos_token='' |
line:78 add self._eos_token='<eos>' |
The same question as the one asked in the previous message, comparing ChatGLM2's demo, will output "// Another topic" in the answer. What is the reason for this? Did ChatGLM2 use special ending symbols? Any ideas? |
Found the reason(thanks lejunzhu): Similar to LLaM's quick fix, it needs to be manually set the diff --git a/modules/models.py b/modules/models.py
index 4b47e64..dea9e73 100644
--- a/modules/models.py
+++ b/modules/models.py
@@ -116,6 +116,17 @@ def load_tokenizer(model_name, model):
if path_to_model.exists():
tokenizer = AutoTokenizer.from_pretrained(path_to_model, trust_remote_code=shared.args.trust_remote_code)
+ if 'chatglm' in model_name.lower():
+ try:
+ tokenizer.eos_token_id = 2
+ except:
+ pass
+ try:
+ tokenizer.bos_token_id = 1
+ tokenizer.pad_token_id = 0
+ except:
+ pass
+
return tokenizer But I don't know why my |
This issue has been closed due to inactivity for 30 days. If you believe it is still relevant, please leave a comment below. |
Describe the bug
chatglm2-6b load successfully but canot chat,input message response nothing,and the terminal show the following errors
Traceback (most recent call last):
File "/ssd_data01/text-generation-webui/modules/callbacks.py", line 73, in gentask
ret = self.mfunc(callback=_callback, **self.kwargs)
File "/ssd_data01/text-generation-webui/modules/text_generation.py", line 263, in generate_with_callback
shared.model.generate(**kwargs)
File "/home/elven/miniconda3/envs/tgweb/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/elven/miniconda3/envs/tgweb/lib/python3.10/site-packages/transformers/generation/utils.py", line 1285, in generate
eos_token_id = eos_token_id[0]
IndexError: list index out of range
Is there an existing issue for this?
Reproduction
load the model and in chat message mode ,input the message in the chabox,response nothing
Screenshot
Logs
System Info
The text was updated successfully, but these errors were encountered: