本文主要是介绍No module named ‘torch.distributed.checkpoint.format_utils问题解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
完整代码:
Traceback (most recent call last):File "/data/user/BMLU-use/src/English_chat/qwen1.5.py", line 97, in <module>main(model_path=args.model_path,max_length=args.max_length,name=args.name)File "/data/user/BMLU-use/src/English_chat/qwen1.5.py", line 76, in mainmodel = AutoModelForCausalLM.from_pretrained(File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 562, in from_pretrainedmodel_class = _get_model_class(config, cls._model_mapping)File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 383, in _get_model_classsupported_models = model_mapping[type(config)]File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 734, in __getitem__return self._load_attr_from_module(model_type, model_name)File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 748, in _load_attr_from_modulereturn getattribute_from_module(self._modules[module_name], attr)File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 692, in getattribute_from_moduleif hasattr(module, attr):File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1525, in __getattr__module = self._get_module(self._class_to_module[name])File "/data/user/zwh_llm/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1537, in _get_moduleraise RuntimeError(
RuntimeError: Failed to import transformers.models.qwen2.modeling_qwen2 because of the following error (look up to see its traceback):
Failed to import transformers.generation.utils because of the following error (look up to see its traceback):
No module named 'torch.distributed.checkpoint.format_utils'
解决方法:更新torch和torchvision
pip install --upgrade torch torchvision
参考资料:
https://stackoverflow.com/questions/59012616/problem-importing-module-modulenotfounderror-no-module-named-torch-utils-chec
这篇关于No module named ‘torch.distributed.checkpoint.format_utils问题解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!