gpt4 book ai didi

pytorch - 谷歌 Colab : "Unable to connect to the runtime" after uploading Pytorch model from local

转载 作者:行者123 更新时间:2023-12-01 16:03:32 25 4
gpt4 key购买 nike

我正在使用一种简单(不一定有效)的方法来保存 Pytorch 模型。

import torch
from google.colab import files

torch.save(model, filename) # save a trained model on the VM
files.download(filename) # download the model to local

best_model = files.upload() # select the model just downloaded
best_model[filename] # access the model

Colab 在执行最后一行时断开连接,并点击 RECONNECT标签总是显示 ALLOCATING -> CONNECTING (失败,左下角显示“无法连接到运行时”消息)-> RECONNECT .同时,执行任何一个单元格都会给出错误消息“无法执行单元格,无法向运行时发送执行消息:[object CloseEvent]”

我知道它与最后一行有关,因为我可以成功连接到其他不执行该操作的 google 帐户。

为什么会发生?似乎已执行最后一行的 google 帐户无法再连接到运行时。

编辑:

一晚后,我可以在 session 到期后重新连接 google 帐户。我刚刚尝试了评论中的方法,发现只是 files.upload() Pytorch 模型会导致这个问题。上传完成后,Colab 会断开连接。

最佳答案

尝试禁用您的广告拦截器。为我工作

关于pytorch - 谷歌 Colab : "Unable to connect to the runtime" after uploading Pytorch model from local,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50675219/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com