Jupyter笔记本电脑服务器崩溃



我刚买了一个GPU,放在我托管jupyter笔记本的电脑里。我通过ssh将jupyter笔记本电脑的输出从塔传输到我的笔记本电脑。我正在运行一些代码,jupyter笔记本每次都会冻结在同一行。不仅木星笔记本冻结了,塔上的所有东西也冻结了。如果我有任何其他ssh连接,它们就会冻结。如果我直接在塔上使用GUI,它就会被冻结。在我按下电源按钮重置计算机之前,没有任何响应。

奇怪的是,虽然没有任何回应,但也没有任何超时。ssh会话保持它们的连接。jupyter笔记本主页声称它仍然处于连接状态。这很奇怪,我不确定这是代码或塔的问题,所以我不确定我是否应该在这里或其他地方发布这篇文章。但这是代码

def show_img(x):
x = x.clone().detach().permute(1,2,0).numpy()
print(x.shape)
x = rio.convert_tensor_to_rgb(x)
print(x.shape)
plt.figure(figsize=(8, 8))
plt.axis('off')
_ = plt.imshow(x)
# define generator discriminator, dataloader, other stuff....
G.cuda()
D.cuda()
g_optim = optim.RMSprop(G.parameters(), lr=lr)
d_optim = optim.RMSprop(D.parameters(), lr=lr)
g_losses = []
d_losses = []
i_losses = []
for epoch in range(n_epochs):
dataloader = DataLoader(train_dataset, batch_size=batch_size,
shuffle=True, pin_memory=True,
num_workers=num_workers)
g_loss = 0.0 # g_loss is the generator's loss
d_loss = 0.0 # d_loss is the discriminator's loss
i_loss = 0.0 # i_loss is the generator's loss for not being invertable
i_weight = 10 # prioritize being invertible ten times more than minimizing g_loss
x,y,z = train_dataset[0]
print("image")
show_img(x)
print("target")
show_img(y)
print("generated")
x,y = x.cuda(), y.cuda()
g = G(x.unsqueeze(0),y.unsqueeze(0))
print(g.shape)
show_img(g.squeeze().cpu())
loop = tqdm(total=len(dataloader), position=0, file=sys.stdout)
print("just to be sure") #prints this
for minibatch, (image, batchImage, exp_batch) in enumerate(dataloader): #this is the line it freezes on?
print("image ", image.shape, " batchImage ", batchImage.shape, " experiment batch ", exp_batch) # doesn't print this. already frozen

EDIT:GUI和ssh响应迅速,但速度异常缓慢。我想主要的问题是代码仍然冻结在所说的代码行上,我不知道为什么。

我发现了问题。批量大小为32,考虑到图像的大小,这是非常大的。我想它只是在试着把它们都装进去后坠毁了。

最新更新