You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python /home/ljh/git/GLM-4/basic_demo/trans_cli_demo.py
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:01<00:00, 8.43it/s]
Some parameters are on the meta device because they were offloaded to the cpu.
Welcome to the GLM-4-9B CLI chat. Type your messages below.
You: 你好
Traceback (most recent call last):
File "/home/ljh/git/GLM-4/basic_demo/trans_cli_demo.py", line 82, in
model_inputs = tokenizer.apply_chat_template(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1891, in apply_chat_template
out = self(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3024, in call
encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3134, in _call_one
return self.encode_plus(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3210, in encode_plus
return self._encode_plus(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 801, in _encode_plus
return self.prepare_for_model(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3706, in prepare_for_model
encoded_inputs = self.pad(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3508, in pad
encoded_inputs = self._pad(
TypeError: _pad() got an unexpected keyword argument 'padding_side'
尝试降低版本为 transformers==4.44.2
可以正常回答,但是有警告信息(The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results.),且响应十分缓慢。
Welcome to the GLM-4-9B CLI chat. Type your messages below.
You: 你好
GLM-4:The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results.
您好👋!我是人工智能助手,很高兴为您服务。有什么可以帮助您的吗?
Expected behavior / 期待表现
麻烦更新修改后的代码~~~
The text was updated successfully, but these errors were encountered:
System Info / 系統信息
python=3.9
CUDA Version: 12.4
GPU:4090 24G
新建的干净环境使用 pip install -r requirements.txt 安装的环境。安装版本与 requirements 相同
Who can help? / 谁可以帮助到您?
@wwewwt @cenyk1230
Information / 问题信息
Reproduction / 复现过程
$ python /home/ljh/git/GLM-4/basic_demo/trans_cli_demo.py
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:01<00:00, 8.43it/s]
Some parameters are on the meta device because they were offloaded to the cpu.
Welcome to the GLM-4-9B CLI chat. Type your messages below.
You: 你好
Traceback (most recent call last):
File "/home/ljh/git/GLM-4/basic_demo/trans_cli_demo.py", line 82, in
model_inputs = tokenizer.apply_chat_template(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1891, in apply_chat_template
out = self(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3024, in call
encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3134, in _call_one
return self.encode_plus(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3210, in encode_plus
return self._encode_plus(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 801, in _encode_plus
return self.prepare_for_model(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3706, in prepare_for_model
encoded_inputs = self.pad(
File "/home/ljh/.conda/envs/GLM4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3508, in pad
encoded_inputs = self._pad(
TypeError: _pad() got an unexpected keyword argument 'padding_side'
尝试降低版本为 transformers==4.44.2
可以正常回答,但是有警告信息(The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's
attention_mask
to obtain reliable results.),且响应十分缓慢。Welcome to the GLM-4-9B CLI chat. Type your messages below.
You: 你好
GLM-4:The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's
attention_mask
to obtain reliable results.您好👋!我是人工智能助手,很高兴为您服务。有什么可以帮助您的吗?
Expected behavior / 期待表现
麻烦更新修改后的代码~~~
The text was updated successfully, but these errors were encountered: