cannot import name 'SlidingWindowCache' from 'transformers.cache_utils'

#71
by alighabusaleh - opened

I have the following issue

  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/user/.cache/huggingface/modules/transformers_modules/microsoft/Phi-4-multimodal-instruct/0af439b3adb8c23fda473c4f86001dbf9a226021/modeling_phi4mm.py", line 29, in <module>
    from transformers.cache_utils import Cache, DynamicCache, SlidingWindowCache, StaticCache
ImportError: cannot import name 'SlidingWindowCache' from 'transformers.cache_utils'

however the version is correct

(.newEnv) user:~$ pip show transformers 
Name: transformers
Version: 4.48.2
Summary: State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow
Home-page: https://github.com/huggingface/transformers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)
Author-email: [email protected]
License: Apache 2.0 License
Location: ~/.newEnv/lib/python3.10/site-packages
Requires: filelock, huggingface-hub, numpy, packaging, pyyaml, regex, requests, safetensors, tokenizers, tqdm
Required-by: peft, pysentimiento, sentence-transformers

any idea how to fix this issue?

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment