Hi, I did it but it didn’t work:
def load_model(weights):
model = TinyYoloNet()
model.load_state_dict(torch.load(weights))
return model

model = load_model(weights=“F:\VIDEOS\PHYTON\My tests\test PYTORCH\yolo-week4\tiny-yolo-voc-weights.pth”)
print(model)
but  the error is:
File “”, line 4, in load_model
model.load_state_dict(torch.load(weights))
File “C:\Users\AMIN\Anaconda3\lib\site-packages\torch\serialization.py”, line 529, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File “C:\Users\AMIN\Anaconda3\lib\site-packages\torch\serialization.py”, line 692, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
UnpicklingError: invalid load key, ‘\x00’.