I am trying to train Yolov7 on a custom dataset, but it's taking too long - so I launch it, then I take the weight generated by the model and put it as initial weight to train again.
I cloned the yoloV7 repository: git clone https://github.com/WongKinYiu/yolov7. Then I trained my model with this initial weight.
Then I try to train a model with the weight I just generated. Specifically, I try to launch "best.pt" being the weights I got from the previous training, like so:
train.py --batch 16 --epochs 10 --data {dataset.location}/data.yaml --weights 'best.pt' --device 0
But I get this error:
Traceback (most recent call last):
File "train.py", line 616, in <module>
train(hyp, opt, device, tb_writer)
File "train.py", line 71, in train
run_id = torch.load(weights, map_location=device).get('wandb_id') if weights.endswith('.pt') and os.path.isfile(weights) else None
File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 920, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\x0a'.
Why does this happen? How can I fix it?