【问题标题】:Are PyTorch-trained models transferable between GPUs and TPUs?PyTorch 训练的模型可以在 GPU 和 TPU 之间转移吗?
【发布时间】:2021-11-18 13:30:21
【问题描述】:

在使用 GPU 训练 PyTorch 模型后,我可以使用保存的权重继续在 TPU 上训练我的模型吗?

【问题讨论】:

标签: pytorch gpu tpu


【解决方案1】:

在使用 GPU 一段时间后,我可以使用保存的权重来使用 TPU 训练我的模型吗?

是的,如果你保存了你的 GPU 训练模型,比如说

    torch.save(model.save_dict(), 'model.pt')

您可以在单独的程序中再次加载它以在 TPU 上使用(使用 https://github.com/pytorch/xla

    import torch_xla.utils.serialization as xser
    
    model.load_state_dict(xser.load('model.pt'))

【讨论】:

    猜你喜欢
    • 2018-03-28
    • 2019-12-05
    • 2019-06-12
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    • 1970-01-01
    • 2018-09-25
    • 2019-09-01
    相关资源
    最近更新 更多