Error using torch.load() (.pt file is corrupted)

Hi everyone,

I’m running a YoloV5 model on Azure ML using a compute cluster. In the train file I changed opt.save_dir from str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) to 'logs/', since that is required when running on AzureML (to save the weights somewhere). The folder is indeed created, but when downloading last.pt/best.pt and running !python detect.py --img 512 --data data/images --weights last.pt the following error will occur: RuntimeError: PytorchStreamReader failed reading file data/0: invalid header or archive is corrupted. The same error will occur when using torch.load(best.pt)

EDIT: The validation part (using best.pt) when the training process is finished does work, but after downloading the “best.pt” file locally and loading it, it gives errors.

Anyone who might know what the cause of the error is?

Thanks in advance,
Kind regards,
Olivier