【发布时间】:2020-04-08 05:39:47
【问题描述】:
我刚买了一个 GPU 来安装我托管 jupyter 笔记本的计算机。我通过 ssh 将 jupyter 笔记本的输出从塔式传输到我的笔记本电脑。我正在运行一些代码,jupyter notebook 每次都冻结在同一行。不仅 jupyter notebook 冻结,而且塔上的所有东西都冻结了。如果我有任何其他 ssh 连接,它们会冻结。如果我直接在塔上使用 GUI,它就会被冻结。在我按下电源按钮重置计算机之前,没有任何响应。
奇怪的是,虽然没有响应,但也没有超时。 ssh 会话保持它们的连接。 jupyter notebook 主页声称它仍然处于连接状态。这很奇怪,我不确定这是代码或塔的问题,所以我不确定是否应该将其发布在这里或其他地方。但这是代码
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
编辑:GUI 和 ssh 响应迅速,但异常缓慢。我想主要问题是代码仍然冻结在所述代码行上,我不知道为什么。
【问题讨论】: