UnpicklingError: invalid load key, '\x00'

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

Hi, even I am facing the same issue. Did you figure this out yet?

Unfortunately not yet. but It seems that we should changes yolo darknet weights to pytorch weights

hi, did you solve this problem now ? I find the same problem and do not know how to figure it out .

Hi, Did you solve the problem? I had the same problem you had when I was loading the yolo weight to my model. I saw someone say it was because of macOS hidden folders. Not sure what operating system you’re using