Problem with training Scaled-YOLOv4 Pytorch on custom dataset tutorial

I am trying to train Scaled-YOLOv4 on custom dataset according to the tutorial provided by Roboflow. I followed all the code on the Google Colab exactly. I used the code below for training:

# train scaled-YOLOv4 on custom data for 100 epochs
# time its performance
%cd /content/ScaledYOLOv4/
!python train.py --weights 'weights/yolov4-csp.conv.142' --cfg 'models/yolov4-csp.yaml' --img 416 --batch 16 --epochs 100 --data {dataset.location}/data.yaml --cache --name yolov4-csp-results  

However, when trying to run the command for training, I got the following error:

  1. Screen shot of your error

  2. Copy/Paste of your code

Traceback (most recent call last):
File “train.py”, line 443, in
train(hyp, opt, device, tb_writer)
File “train.py”, line 72, in train
model = Model(opt.cfg, ch=3, nc=nc).to(device)# create
File “/content/ScaledYOLOv4/models/yolo.py”, line 83, in init
self._initialize_biases() # only run once
File “/content/ScaledYOLOv4/models/yolo.py”, line 141, in _initialize_biases
b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.

  1. What you’ve tried so far to debug
    Nil

@axlecky here is how to solve the issue, fully diagnosed: