InstColorization icon indicating copy to clipboard operation
InstColorization copied to clipboard

FileNotFoundError in Colab Demo

Open PiotrMi opened this issue 5 years ago • 4 comments

Using the unmodified Google Colab Demo. I think it has something to do with the zip file not being downloaded correctly. The size of the zip is only around 3KB. Maybe the Google Drive download is being rate limited?

Error:

initialize network with normal
initialize network with normal
initialize network with normal
model [FusionModel] was created
load Fusion model from checkpoints/coco_finetuned_mask_256_ffs/latest_net_GF.pth
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-11-e948e7e9ae19> in <module>()
      1 model = create_model(opt)
----> 2 model.setup_to_test('coco_finetuned_mask_256_ffs')

3 frames
/content/InstColorization/models/fusion_model.py in setup_to_test(self, fusion_weight_path)
     95         GF_path = 'checkpoints/{0}/latest_net_GF.pth'.format(fusion_weight_path)
     96         print('load Fusion model from %s' % GF_path)
---> 97         GF_state_dict = torch.load(GF_path)
     98 
     99         # G_path = 'checkpoints/coco_finetuned_mask_256/latest_net_G.pth' # fine tuned on cocostuff

/usr/local/lib/python3.6/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
    582         pickle_load_args['encoding'] = 'utf-8'
    583 
--> 584     with _open_file_like(f, 'rb') as opened_file:
    585         if _is_zipfile(opened_file):
    586             with _open_zipfile_reader(f) as opened_zipfile:

/usr/local/lib/python3.6/dist-packages/torch/serialization.py in _open_file_like(name_or_buffer, mode)
    232 def _open_file_like(name_or_buffer, mode):
    233     if _is_path(name_or_buffer):
--> 234         return _open_file(name_or_buffer, mode)
    235     else:
    236         if 'w' in mode:

/usr/local/lib/python3.6/dist-packages/torch/serialization.py in __init__(self, name, mode)
    213 class _open_file(_opener):
    214     def __init__(self, name, mode):
--> 215         super(_open_file, self).__init__(open(name, mode))
    216 
    217     def __exit__(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/coco_finetuned_mask_256_ffs/latest_net_GF.pth'

PiotrMi avatar Nov 08 '20 13:11 PiotrMi

Do you run the section 4 for downloading the model?

!sh scripts/download_model.sh

I've just checked the notebook, and still not found any problem.

ericsujw avatar Nov 09 '20 06:11 ericsujw

Yes, I ran the script. This is it's output:

Downloading...
Finish download.
Archive:  checkpoints.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of checkpoints.zip or
        checkpoints.zip.zip, and cannot find checkpoints.zip.ZIP, period.

PiotrMi avatar Nov 09 '20 15:11 PiotrMi

Got the same issue when ran from localhost. But it works on Colab.

sparanoid avatar Nov 10 '20 11:11 sparanoid

I am getting the error on Colab. I guess outdated link, and still I can't find another location.

Twenkid avatar Mar 11 '22 06:03 Twenkid