CogVLM
CogVLM copied to clipboard
AttributeError: 'str' object has no attribute 'shape'
System Info / 系統信息
Google Colab A100 Cuda
Who can help? / 谁可以帮助到您?
I am using the script in https://huggingface.co/THUDM/cogvlm-base-224-hf but I get this error:
~/.cache/huggingface/modules/transformers_modules/THUDM/cogvlm-base-224-hf/cf0930a30d930c4ad0de393726385591a0271567/modeling_cogvlm.py in llm_forward(self, input_ids, token_type_ids, attention_mask, position_ids, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict) 439 440 if past_key_values is not None: --> 441 past_key_values_length = past_key_values[0][0].shape[2] 442 seq_length_with_past = seq_length_with_past + past_key_values_length 443
AttributeError: 'str' object has no attribute 'shape'
Information / 问题信息
- [X] The official example scripts / 官方的示例脚本
- [ ] My own modified scripts / 我自己修改的脚本和任务
Reproduction / 复现过程
I ran the script from both THUDM/cogvlm-chat-hf as well as THUDM/cogvlm-base-224-hf with several different formats of images but always get the same error. I double checked that the inputs are all of the right expected type.
Expected behavior / 期待表现
2 weeks ago, when I ran the script, I did not get this error. Instead it'd generate a valid word/sentence output.
You can refer the issue here https://github.com/THUDM/CogVLM/issues/517 , add a simple _ in the modeling code, or just install a older version(<4.42.0) of transformers lib can work.
Why I can't modify the code? Every time I make changes and run it, the code reverts back to its original state.
Why I can't modify the code? Every time I make changes and run it, the code reverts back to its original state.
Remove the python cache may work?
Why I can't modify the code? Every time I make changes and run it, the code reverts back to its original state.
Remove the python cache may work?
thanks,i will try it. choose the version of 4.36.2 may also works
Why I can't modify the code? Every time I make changes and run it, the code reverts back to its original state.
Remove the python cache may work?
thanks,i will try it. choose the version of 4.36.2 may also works
Set the specific version is the optimal solution 👀