THUDM/CogVLM2

Fail to run a demo

avalonliberty opened this issue · 2 comments

System Info / 系統信息

OS: Ubuntu 22.04
Cuda: 12.2
Python: 3.12.4

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

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

  1. Get into the basic_demo directory
  2. run the following chunk of code
CUDA_VISIBLE_DEVICES=0 python cli_demo.py --quant 4
image path >>>>> demo.jpg
Human:Do you think this is a spring or winter photo?

Expected behavior / 期待表现

I should get something like the answer from LLM, but the error message popped out.

File "/home/ubuntu/.cache/huggingface/modules/transformers_modules/THUDM/cogvlm2-llama3-chat-19B/2bf7de6892877eb50142395af14847519ba95998/modeling_cogvlm.py", line 452, in llm_forward
    past_key_values_length = past_key_values[0][0].shape[2]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'shape'

check transformers version, try to pip install transformers==4.40.1

降级到4.40