Open Subhan-Zaheer opened 5 months ago
Whenever I try to load pre-trained models, I get the following error:
`--------------------------------------------------------------------------- UnpicklingError Traceback (most recent call last) in <cell line: 7>() 5 6 vtoonify = VToonify(backbone = 'dualstylegan') ----> 7 vtoonify.load_state_dict(torch.load(os.path.join(MODEL_DIR, style_type+'_generator.pt'), map_location=lambda storage, loc: storage)['g_ema']) 8 vtoonify.to(device) 9
1 frames /usr/local/lib/python3.10/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, weights_only, mmap, pickle_load_args) 1038 except RuntimeError as e: 1039 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None -> 1040 return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) 1041 1042
/usr/local/lib/python3.10/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, pickle_load_args) 1256 "functionality.") 1257 -> 1258 magic_number = pickle_module.load(f, pickle_load_args) 1259 if magic_number != MAGIC_NUMBER: 1260 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: invalid load key, '<'.`
Can you please tell what's the issue here, is there a version incompatibility of language or framework.
@williamyang1991
I guess it caused by invalid file path, did ur dictionary contains "<"?
No, it doesn't contain this '<'.
Here is a similar issue https://github.com/CSAILVision/places365/issues/49
I suppose your model is not completely downloaded?
@Subhan-Zaheer Were you able to solve this issue ? I am encountering same issue
Whenever I try to load pre-trained models, I get the following error:
`--------------------------------------------------------------------------- UnpicklingError Traceback (most recent call last) in <cell line: 7>()
5
6 vtoonify = VToonify(backbone = 'dualstylegan')
----> 7 vtoonify.load_state_dict(torch.load(os.path.join(MODEL_DIR, style_type+'_generator.pt'), map_location=lambda storage, loc: storage)['g_ema'])
8 vtoonify.to(device)
9
1 frames /usr/local/lib/python3.10/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, weights_only, mmap, pickle_load_args) 1038 except RuntimeError as e: 1039 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None -> 1040 return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) 1041 1042
/usr/local/lib/python3.10/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, pickle_load_args) 1256 "functionality.") 1257 -> 1258 magic_number = pickle_module.load(f, pickle_load_args) 1259 if magic_number != MAGIC_NUMBER: 1260 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: invalid load key, '<'.`
Can you please tell what's the issue here, is there a version incompatibility of language or framework.