THUDM / GLM-4

GLM-4 series: Open Multilingual Multimodal Chat LMs | 开源多语言多模态对话模型
Apache License 2.0
4.8k stars 396 forks source link

GLM-4v-9b运行报错:TypeError: ChatGLM4Tokenizer._pad() got an unexpected keyword argument 'padding_side' #578

Open tw-repository opened 1 day ago

tw-repository commented 1 day ago

System Info / 系統信息

所有硬件条件正确,环境正确。因为所有代码、环境、设备等都未改动,在一个月前能够是能够正常运行的。而现在无法正常运行,不知道问题出在哪里。

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

Reproduction / 复现过程

输入图像 输入问题 报错: Traceback (most recent call last): File "/mnt/disk/tw_data/train/GLM-4-main/basic_demo/trans_cli_vision_demo.py", line 92, in model_inputs = tokenizer.apply_chat_template( File "/root/.cache/huggingface/modules/transformers_modules/glm-4v-9b/tokenization_chatglm.py", line 251, in apply_chat_template output = self.batch_encode_plus( File "/home/sa/anaconda3/envs/glm4v/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3306, in batch_encode_plus return self._batch_encode_plus( File "/home/sa/anaconda3/envs/glm4v/lib/python3.10/site-packages/transformers/tokenization_utils.py", line 889, in _batch_encode_plus batch_outputs = self._batch_prepare_for_model( File "/home/sa/anaconda3/envs/glm4v/lib/python3.10/site-packages/transformers/tokenization_utils.py", line 967, in _batch_prepare_for_model batch_outputs = self.pad( File "/home/sa/anaconda3/envs/glm4v/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3522, in pad outputs = self._pad( TypeError: ChatGLM4Tokenizer._pad() got an unexpected keyword argument 'padding_side'

Process finished with exit code 1

Expected behavior / 期待表现

修正错误后,正常运行。

IntelligentSynthesis commented 1 day ago

参考 https://huggingface.co/THUDM/LongWriter-glm4-9b/commit/778b5712634889f5123d6c463ca383bc6dd5c621 在def _pad这里修改即可解决。