Yolov5 retraining problem

i followed the steps in the yolov5m tutorial retraining model. I also adjusted numclass (nc) = 7 in data.yaml and yolov5m.yaml (I use same dataset in tutorial video). I also use the same command, but there still some error :
1.
UserWarning: This overload of nonzero is deprecated:
nonzero()
Consider using one of the following signatures instead:
nonzero(*, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1607370172916/work/torch/csrc/utils/python_arg_parser.cpp:882.)
i, j = (x[:, 5:] > conf_thres).nonzero().t()

=> fixed : i, j = (x[:, 5:] > conf_thres).nonzero().t()
→ i, j = (x[:, 5:] > conf_thres).nonzero(as_tuple=True)

note : after this error , there will appear some same error about ‘nonzero’, still fix like above.

File “train.py”, line 340, in train
results, maps, times = test.test(opt.data,
File “/workspace/yolov5/test.py”, line 164, in test
correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
File “/opt/conda/lib/python3.8/site-packages/torch/tensor.py”, line 27, in wrapped
return f(*args, **kwargs)
RuntimeError: The size of tensor a (0) must match the size of tensor b (10) at non-singleton dimension 0

=> fixed : correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
→ correct[pi[j]] = (ious[j].unsqueeze(-1) > iouv).all()
3.
File “train.py”, line 340, in train
results, maps, times = test.test(opt.data,
File “/workspace/yolov5/test.py”, line 162, in test
if d not in detected:
File “/opt/conda/lib/python3.8/site-packages/torch/tensor.py”, line 27, in wrapped
return f(*args, **kwargs)
RuntimeError: The size of tensor a (0) must match the size of tensor b (12) at non-singleton dimension 0
I can’t fix this. Pls help me…

Hi, re the first warning:

This is only a warning, it’s likely not a problem.

And about the RuntimeError, I just made a post that goes through all of the necessary steps for re-training and compiling:

There are steps about creating and editing the dataset that are not relevant to you, but please go through the reamining steps to confirm that everything was done correctly and let us know if you still see the error.

Sorry for the delayed response. My computer is quite weak and I struggled for dozens of hours to process it. Finally, I tried creating a small dataset, ran it with the yolov5s model and succeeded. All previous errors seem to be due to me using CPU overload (after running some epochs, the traning process stops and shows ‘killed’ . (I use server in VMware so can’t connect GPU ).