【已解决】cannot import name ‘Cache‘ from ‘transformers‘_cannot import name 'encoderdecodercache' from 'tra-CSDN博客

尝试上述版本安装后

卸载其他无效包

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
llmtuner 0.3.1 requires gradio<4.0.0,>=3.38.0, but you have gradio 5.31.0 which is incompatible.
llmtuner 0.3.1 requires transformers<4.35.0,>=4.31.0, but you have transformers 4.52.4 which is incompatible.
Successfully installed gradio-5.31.0 gradio-client-1.10.1 llamafactory-0.9.4.dev0 peft-0.15.2 tokenizers-0.21.1 transformers-4.52.4
pip uninstall llmtuner

重新安装依赖

pip install -e ".[torch,metrics]" --no-build-isolation

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐