ImportError: cannot import name 'WHISPER_ATTENTION_CLASSES'
ImportError: cannot import name 'WHISPER_ATTENTION_CLASSES' from 'transformers.models.whisper.modeling_whisper' (/usr/local/lib/python3.10/dist-packages/transformers/models/whisper/modeling_whisper.py)
At:
/root/.cache/huggingface/modules/transformers_modules/openbmb/MiniCPM-o-2_6/9da79acdd8906c7007242cbd09ed014d265d281a/modeling_minicpmo.py(59):
(241): _call_with_frames_removed
(883): exec_module
/usr/local/lib/python3.10/dist-packages/transformers/dynamic_module_utils.py(277): get_class_in_module
/usr/local/lib/python3.10/dist-packages/transformers/dynamic_module_utils.py(582): get_class_from_dynamic_module
/usr/local/lib/python3.10/dist-packages/transformers/models/auto/auto_factory.py(582): from_pretrained
/model_repository/minicpm_text_generation/2/model.py(31): initialize
How can I fix this error?
I am using transformers==4.53.1
Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("openbmb/MiniCPM-o-2_6", trust_remote_code=True)
ImportError Traceback (most recent call last)
/tmp/ipython-input-8-3138066104.py in <cell line: 0>()
1 # Load model directly
2 from transformers import AutoModel
----> 3 model = AutoModel.from_pretrained("openbmb/MiniCPM-o-2_6", trust_remote_code=True)
5 frames
~/.cache/huggingface/modules/transformers_modules/openbmb/MiniCPM-o-2_6/9da79acdd8906c7007242cbd09ed014d265d281a/modeling_minicpmo.py in
57 from transformers.modeling_outputs import ModelOutput
58 from transformers.models.whisper.modeling_whisper import ACT2FN
---> 59 from transformers.models.whisper.modeling_whisper import WHISPER_ATTENTION_CLASSES
60 from transformers.models.whisper.modeling_whisper import WhisperConfig
61 from transformers.models.whisper.modeling_whisper import WhisperEncoder
ImportError: cannot import name 'WHISPER_ATTENTION_CLASSES' from 'transformers.models.whisper.modeling_whisper' (/usr/local/lib/python3.11/dist-packages/transformers/models/whisper/modeling_whisper.py)
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.