【pytorch报错】If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True

背景

加载torch的huggingface的bin模型,未使用复杂处理逻辑,但是出现异常,详细报错内容

OSError: Unable to load weights from pytorch checkpoint file for 
'xxxxx/huggingface_model/bart-large-chinese' 
at 'xxxxxx/huggingface_model/bart-large-chinese/pytorch_model.bin'
If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

尝试

  1. 设置from_tf=True, 结果并有改善
  2. 按照提示,以为是TF的版本太高,于是查看TF版本,结果报错
ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 
(required by xxxxx/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)

发现机器上并没有安装TF

解决办法

说来解决办法有点水,参考之前有效的机器,发现torch的版本是1.11,后来将原始版本升级到1.11

你可能感兴趣的:(填坑笔记,pytorch,tensorflow,深度学习)