解决报错RuntimeError: Failed to import transformers.trainer_seq2seq because of the following error

RuntimeError: Failed to import transformers.trainer_seq2seq because of the following error (look up to see its traceback):
cannot import name 'is_npu_available' from 'accelerate.utils' (/usr/local/lib/python3.10/dist-packages/accelerate/utils/__init__.py)

参考:https://github.com/huggingface/transformers/issues/23340

需要升级accelerate包

pip install -U accelerate

执行即可。

你可能感兴趣的:(python,transformer)