OpenBMB / MiniCPM-V

MiniCPM-V 2.6: A GPT-4V Level MLLM for Single Image, Multi Image and Video on Your Phone
Apache License 2.0
12.51k stars 879 forks source link

[BUG] 运行2.6的demo报错 No module named 'transformers_modules.minicpm_v2' #420

Closed jiaowei-it closed 3 months ago

jiaowei-it commented 3 months ago

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

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

当前行为 | Current Behavior

(base) root@:/root/xxx/MiniCPM-V# python web_demo_2.6.py Traceback (most recent call last): File "/root/xxx/MiniCPM-V/web_demo_2.6.py", line 69, in model = AutoModel.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.bfloat16) File "/root/miniconda3/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 523, in from_pretrained config, kwargs = AutoConfig.from_pretrained( File "/root/miniconda3/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 937, in from_pretrained config_class = get_class_from_dynamic_module( File "/root/miniconda3/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 501, in get_class_from_dynamic_module return get_class_in_module(class_name, final_module) File "/root/miniconda3/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 201, in get_class_in_module module = importlib.machinery.SourceFileLoader(name, module_path).load_module() File "", line 548, in _check_name_wrapper File "", line 1063, in load_module File "", line 888, in load_module File "", line 290, in _load_module_shim File "", line 719, in _load File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/root/.cache/huggingface/modules/transformers_modules/minicpm_v2.6/configuration_minicpm.py", line 9, in from .modeling_navit_siglip import SiglipVisionConfig ModuleNotFoundError: No module named 'transformers_modules.minicpm_v2'

期望行为 | Expected Behavior

runing.

复现方法 | Steps To Reproduce

1、Clone this repository and navigate to the source folder git clone https://github.com/OpenBMB/MiniCPM-V.git cd MiniCPM-V

2、Create conda environment conda create -n MiniCPM-V python=3.10 -y conda activate MiniCPM-V

3、Install dependencies pip install -r requirements.txt

4、prepair model file: download file from https://huggingface.co/openbmb/MiniCPM-V-2_6 to ../minicpm_v2.6/ modify model path in python file. 5、 python web_demo_2.6.py or code of Multi-turn Conversation

运行环境 | Environment

- OS: velinux1u1 SMP Debian 5.4.250-2-velinux1u1
- Python: Python 3.10.12
- Transformers: 4.40.0
- PyTorch:2.1.2
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):12.1

备注 | Anything else?

.

iceflame89 commented 3 months ago

Due to the dynamic import mechanism issue in transformers, having a dot in the model directory name can cause import errors. Please change the dot in the model directory ../minicpm_v2.6/ to _ or another character, like ../minicpm_v2_6/.

jiaowei-it commented 3 months ago

Due to the dynamic import mechanism issue in transformers, having a dot in the model directory name can cause import errors. Please change the dot in the model directory ../minicpm_v2.6/ to _ or another character, like ../minicpm_v2_6/.

thanks. now succ.