【发布时间】:2019-01-13 05:07:48
【问题描述】:
我正在尝试在 非 GPU 机器上加载 .txt 文件。 .txt 文件被转储到 GPU 机器上:
with open("Data/all_rewards.txt", "wb") as f:
pickle.dump(all_rewards, f)
该文件仅包含文本数据,没有网络模型或其他任何内容。 在 GPU 机器上,我可以毫无问题地加载数据:
with open("all_rewards.txt", 'rb') as f:
losses = pickle.load(f)
然而,在 非 GPU 机器上,我得到了错误:
AssertionError('Torch not compiled with CUDA enabled',)
由于 Torch 也使用 pickle 加载模型,我尝试使用以下方法加载数据:
losses = torch.load("all_rewards.txt", map_location='cpu')
但这没有用。 你能帮我吗?
编辑: 不知何故,这个问题神奇地解决了。我已经重新安装了pickle,它最初并没有解决问题,但现在它可以工作了......
【问题讨论】:
标签: python tensorflow pickle pytorch loaddata