在将自定义的网络权重加载到网络中时,报错:
AttributeError: ‘dict’ object has no attribute ‘seek’. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.
我们一步一步分析。
模型网络权重保存额代码是:torch.sa
状态:存档(代码按原样提供,预计无更新)
伯特·凯拉斯
Google BERT(来自Transformers的双向编码器表示)的Keras实现和OpenAI的Transformer LM能够使用微调API加载预训练的模型。
更新:得益于 TPU支持进行推理和训练
如何使用它?
# this is a pseudo code you can read an actual working example in tutorial.ipynb or the colab notebook
text_e