My data set with the model is loaded into Kaggle.
But I am unable to load in a model. learner.load
appends " /tmp/model/
" to the path I pass giving me a “No such file or directory
” error. Any clue on how I could resolve this?
This is how I am taking input.
This is the error log:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-30-1007c1626e99> in <module>
1 ModPath = Path('../input/vgg-div2k-models/4x_to_2K-V2-DIV2K-VGG-10Epochs')
----> 2 MidX3ToHighLearner.load(ModPath)
/opt/conda/lib/python3.7/site-packages/fastai/learner.py in load(self, file, device, **kwargs)
347 if self.opt is None: self.create_opt()
348 file = join_path_file(file, self.path/self.model_dir, ext='.pth')
--> 349 load_model(file, self.model, self.opt, device=device, **kwargs)
350 return self
351
/opt/conda/lib/python3.7/site-packages/fastai/learner.py in load_model(file, model, opt, with_opt, device, strict)
46 if isinstance(device, int): device = torch.device('cuda', device)
47 elif device is None: device = 'cpu'
---> 48 state = torch.load(file, map_location=device)
49 hasopt = set(state)=={'model', 'opt'}
50 model_state = state['model'] if hasopt else state
/opt/conda/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
579 pickle_load_args['encoding'] = 'utf-8'
580
--> 581 with _open_file_like(f, 'rb') as opened_file:
582 if _is_zipfile(opened_file):
583 # The zipfile reader is going to advance the current file position.
/opt/conda/lib/python3.7/site-packages/torch/serialization.py in _open_file_like(name_or_buffer, mode)
228 def _open_file_like(name_or_buffer, mode):
229 if _is_path(name_or_buffer):
--> 230 return _open_file(name_or_buffer, mode)
231 else:
232 if 'w' in mode:
/opt/conda/lib/python3.7/site-packages/torch/serialization.py in __init__(self, name, mode)
209 class _open_file(_opener):
210 def __init__(self, name, mode):
--> 211 super(_open_file, self).__init__(open(name, mode))
212
213 def __exit__(self, *args):
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/model/../input/vgg-div2k-models/4x_to_2K-V2-DIV2K-VGG-10Epochs.pth'
I notice the path is incorrect in the final line, but that’s not what I’ve passed in. I’ve also tried passing in just the path string, still doesn’t work. Is going up one directory causing issues? I don’t know how to resolve this.
The fact that you have to go up one step seems to be causing issues.