cxzhou95 / XLSR

PyTorch implementation of paper "Extremely Lightweight Quantization Robust Real-Time Single-Image Super Resolution for Mobile Devices"
MIT License
56 stars 9 forks source link

Error in loading the quantized models #14

Open arianaa30 opened 12 months ago

arianaa30 commented 12 months ago

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'>.