taki0112 / UGATIT

Official Tensorflow implementation of U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation (ICLR 2020)
MIT License
6.17k stars 1.04k forks source link

when reading checkpoint file tensorflow.python.framework.errors_impl.OutOfRangeError #59

Open akashdexati opened 5 years ago

akashdexati commented 5 years ago

Hi @taki0112 When reading the checkpoint file selfie2anime(100 epoch); I get tensorflow.python.framework.errors_impl.OutOfRangeError. The tensorflow version I am using is 1.14.0. Can you please guide me on the issue.

Below are the logs for your reference.

 [*] Reading checkpoints...
W0821 04:54:22.281598 140669784717120 deprecation.py:323] From /usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
2019-08-21 04:54:22.506653: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Out of range: Read less bytes than requested
Traceback (most recent call last):
  File "main.py", line 112, in <module>
    main(imgname)
  File "main.py", line 102, in main
    gan.test()
  File "/home/ubuntu/UGATIT/UGATIT.py", line 620, in test
    could_load, checkpoint_counter = self.load(self.checkpoint_dir)
  File "/home/ubuntu/UGATIT/UGATIT.py", line 606, in load
    self.saver.restore(self.sess, os.path.join(checkpoint_dir, ckpt_name))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1286, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run
    run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: Read less bytes than requested
     [[node save/RestoreV2 (defined at /home/ubuntu/UGATIT/UGATIT.py:619) ]]

Original stack trace for u'save/RestoreV2':
  File "main.py", line 112, in <module>
    main(imgname)
  File "main.py", line 102, in main
    gan.test()
  File "/home/ubuntu/UGATIT/UGATIT.py", line 619, in test
    self.saver = tf.train.Saver()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 825, in __init__
    self.build()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 837, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 875, in _build
    build_restore=build_restore)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 508, in _build_internal
    restore_sequentially, reshape)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 328, in _AddRestoreOps
    restore_sequentially)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 575, in bulk_restore
    return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 1696, in restore_v2
    name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()
kikacaty commented 5 years ago

I got the same error here.

xiaotaw commented 5 years ago

check if u got the ckpt files complete.

kikacaty commented 5 years ago

@akashdexati I resolved the issue by downloading and unziping the pretrained model on a MACOS.

ColorfulGhost commented 5 years ago

I got the same error here.

CUDA version? tf version?

FantasyJXF commented 5 years ago

Met the same problem with Google Colab with GPU/Python3

FantasyJXF commented 5 years ago

@akashdexati @kikacaty After you unzip the checkpoint file, you should have a directory named checkpoint which is about 8G Bytes, use the default compress APP on MAC would help.

emtelGNR commented 4 years ago

well , bro ,I just met the same problem , have you slove it? py3.6+tf1.14 2020-08-07 18-43-46屏幕截图

SMY19999 commented 1 year ago

看了大家的讨论,原因应该是解压的时候,ckpt文件损坏了,换一个系统来解压,就好了。