XLSR icon indicating copy to clipboard operation
XLSR copied to clipboard

load model error

Open simplew2011 opened this issue 2 years ago • 4 comments

image

simplew2011 avatar Aug 09 '23 02:08 simplew2011

image

simplew2011 avatar Aug 09 '23 02:08 simplew2011

image

modify torch 1.8 to 1.12 is ok

simplew2011 avatar Aug 09 '23 02:08 simplew2011

Hi, where you able to find a way to load the quantized models? 'best.pt' loads fine, but not the quantized models.

arianaa30 avatar Nov 01 '23 13:11 arianaa30

While loading the regular best.pt model works, but loading the quantized models (like QAT_quantized_model.pt) throws an error. What is the problem?

python test.py --model exp/OneCyclicLR/QAT_quantized_model.pt --device cpu

Error:

C:\Users\AppData\Local\anaconda3\Lib\site-packages\torch\serialization.py:995: UserWarning: 'torch.load' received a zip file that looks like a TorchScript archive dispatching to 'torch.jit.load' (call 'torch.jit.load' directly to silence this warning)
  warnings.warn("'torch.load' received a zip file that looks like a TorchScript archive"
Traceback (most recent call last):
  File "C:\Users\Downloads\XLSR\test.py", line 109, in <module>
    model.load_state_dict(torch.load(opt.model, map_location=device))
  File "C:\Users\AppData\Local\anaconda3\Lib\site-packages\torch\nn\modules\module.py", line 2103, in load_state_dict
    raise TypeError(f"Expected state_dict to be dict-like, got {type(state_dict)}.")
TypeError: Expected state_dict to be dict-like, got <class 'torch.jit._script.RecursiveScriptModule'>.

arianaa30 avatar Nov 01 '23 13:11 arianaa30