CogVLM icon indicating copy to clipboard operation
CogVLM copied to clipboard

AttributeError: 'str' object has no attribute 'shape'

Open spol25 opened this issue 6 months ago • 1 comments

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.

spol25 avatar Aug 02 '24 21:08 spol25