MiniCPM-V icon indicating copy to clipboard operation
MiniCPM-V copied to clipboard

[BUG] <title>'MiniCPMVTokenizerFast' object has no attribute 'image_processor'

Open Labmem009 opened this issue 1 year ago • 1 comments

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • [X] 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • [X] 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

Run demo to test one finetuned minicpm-v2.6 model (I only changed the model path, and finetuned with provided script): CUDA_VISIBLE_DEVICES=2 python web_demo_2.6.py

Upload image and send, it got: msgs: [{'role': 'user', 'content': [<PIL.Image.Image image mode=RGB size=1024x1024 at 0x7F3F16153790>]}] 'MiniCPMVTokenizerFast' object has no attribute 'image_processor' Traceback (most recent call last): File "/MiniCPM-V-main/web_demo_2.6.py", line 134, in chat answer = model.chat( File "/.cache/huggingface/modules/transformers_modules/checkpoint-701/modeling_minicpmv.py", line 302, in chat assert self.config.query_num == processor.image_processor.image_feature_size, "These two values should be the same. Check config.json and preprocessor_config.json." AttributeError: 'MiniCPMVTokenizerFast' object has no attribute 'image_processor'

期望行为 | Expected Behavior

How to solve it?

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

I update the env by pip install -r requirements.txt

备注 | Anything else?

No response

Labmem009 avatar Aug 07 '24 09:08 Labmem009

Plz check the configurations as the hints say. There're some values of these two files should be the same. https://huggingface.co/openbmb/MiniCPM-V-2_6/blob/main/modeling_minicpmv.py#L302

Or you can just post out your config.json and preprocessor_config.json.

HwwwwwwwH avatar Aug 07 '24 13:08 HwwwwwwwH

同样的问题,原模型推理没问题,微调后推理就报这个错

zhouzhoumd avatar Aug 09 '24 02:08 zhouzhoumd

找到原因了,微调后的路径缺了文件 image_processing_minicpmv.py preprocessor_config.json processing_minicpmv.py,拷过去就好了

zhouzhoumd avatar Aug 09 '24 03:08 zhouzhoumd

@zhouzhoumd 请问你是运行2.6的模型微调后出错吗,我们正在check为什么会缺文件

iceflame89 avatar Aug 09 '24 04:08 iceflame89

@zhouzhoumd 请问你是运行2.6的模型微调后出错吗,我们正在check为什么会缺文件

是的,2.6的模型微调后出错的

zhouzhoumd avatar Aug 09 '24 05:08 zhouzhoumd

@zhouzhoumd 请问你是运行2.6的模型微调后出错吗,我们正在check为什么会缺文件

metoo

Labmem009 avatar Aug 09 '24 09:08 Labmem009

@zhouzhoumd 微调后成功推理了,你是我的神!!!!!

Michael4933 avatar Aug 16 '24 15:08 Michael4933

I have the same problem. I did finetuning without Lora of the openbmb/MiniCPM-V-2_6 model. After training for 5 epochs and testing the model I get:

answer = model.chat( File "/home/ascaiella/.cache/huggingface/modules/transformers_modules/openbmb/MiniCPM-V-2_6/4e4be000cd81feda8b96d14b53f1791b4010b038/modeling_minicpmv.py", line 304, in chat assert self.config.query_num == processor.image_processor.image_feature_size, "These two values should be the same. Checkconfig.jsonandpreprocessor_config.json." AttributeError: 'MiniCPMVTokenizerFast' object has no attribute 'image_processor'

piperino11 avatar Aug 30 '24 12:08 piperino11