运行时错误:无法运行';aten::xxxx';,Can';t用TPU训练的Pytorch模型

运行时错误:无法运行';aten::xxxx';,Can';t用TPU训练的Pytorch模型,pytorch,Pytorch,传销培训是根据日本的伯特模式增加的。 当时,我们在Google Colab上使用了TPU。 加载创建的模型时出现以下错误。 有没有加载模型的方法 代码 ​ 输出 我在使用变压器时遇到了同样的错误,我就是这样解决的 在对Colab进行培训后,我不得不将模型发送给CPU。基本上,运行: model.to('cpu') 然后保存模型,这允许我在另一个实例中导入权重 正如错误所暗示的那样 RuntimeError: Could not run 'aten::empty.memory_format' w

传销培训是根据日本的伯特模式增加的。 当时,我们在Google Colab上使用了TPU。 加载创建的模型时出现以下错误。 有没有加载模型的方法

代码

​ 输出


我在使用变压器时遇到了同样的错误,我就是这样解决的

在对Colab进行培训后,我不得不将模型发送给CPU。基本上,运行:

model.to('cpu')
然后保存模型,这允许我在另一个实例中导入权重

正如错误所暗示的那样

RuntimeError: Could not run 'aten::empty.memory_format' with arguments from the 'XLATensorId' backend. 'aten::empty.memory_format' is only available for these backends: [CUDATensorId, SparseCPUTensorId, VariableTensorId, CPUTensorId, MkldnnCPUTensorId, SparseCUDATensorId]

非常感谢你!!它工作正常。我会记下你的答案。很高兴我帮了忙:)
model.to('cpu')
RuntimeError: Could not run 'aten::empty.memory_format' with arguments from the 'XLATensorId' backend. 'aten::empty.memory_format' is only available for these backends: [CUDATensorId, SparseCPUTensorId, VariableTensorId, CPUTensorId, MkldnnCPUTensorId, SparseCUDATensorId]