DmitryUlyanov / deep-image-prior

Image restoration with neural networks but without learning.
https://dmitryulyanov.github.io/deep_image_prior
Other
7.91k stars 1.43k forks source link

ValueError: I/O operation on closed file, while running inpainting code #30

Open AtlantixJJ opened 6 years ago

AtlantixJJ commented 6 years ago

Hi. Thanks for sharing your brilliant work. But I have trouble running inpainting code. I'm using python 2, pytorch 0.3.0. The error message is listed as following. I guess something happens near the end of the training, but I have no idea. I would appreciate it if anyone can tell me how to fix it.

ValueError                                Traceback (most recent call last)
<ipython-input-9-ac0684da7936> in <module>()
     23 
     24 p = get_params(OPT_OVER, net, net_input)
---> 25 optimize(OPTIMIZER, p, closure, LR, num_iter)

/home/atlantix/deep-image-prior/utils/common_utils.pyc in optimize(optimizer_type, parameters, closure, LR, num_iter)
    233         for j in range(num_iter):
    234             optimizer.zero_grad()
--> 235             closure()
    236             optimizer.step()
    237     else:

<ipython-input-9-ac0684da7936> in closure()
     13     total_loss.backward()
     14 
---> 15     print ('Iteration %05d    Loss %f' % (i, total_loss.data[0]), '\r', end='')
     16     if  PLOT and i % show_every == 0:
     17         out_np = var_to_np(out)

/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.pyc in write(self, string)
    315 
    316             is_child = (not self._is_master_process())
--> 317             self._buffer.write(string)
    318             if is_child:
    319                 # newlines imply flush in subprocesses

ValueError: I/O operation on closed file