Deepstack Trainer RuntimeError: a view of a leaf Variable

Hello! I’m trying to use the Deepstack Trainer and after testing it on the dataset provided in the DeepStack v1.2.1 documentation in Windows and the GoogleColab environment I receive the following error. I cannot find anything about this if anyone can point me in the right direction that would be wonderful.

Traceback (most recent call last):
File “C:\Users\Administrator\deepstack-trainer\”, line 530, in
train(hyp, opt, device, tb_writer, wandb)
File “C:\Users\Administrator\deepstack-trainer\”, line 90, in train
model = Model(opt.cfg or ckpt[‘model’].yaml, ch=3, nc=nc).to(device) # create
File “C:\Users\Administrator\deepstack-trainer\models\”, line 96, in init
self._initialize_biases() # only run once
File “C:\Users\Administrator\deepstack-trainer\models\”, line 151, 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.

Thank you for any help!!

I have removed my topic thread as it was a duplicate to this one, but I am also experiencing the exact same error.


Me, too. It has worked before 5 times. Same commands, just a few more pics.

It will run locally, but my video card is really weak.

I ended up getting it to work finally by running this command after installing the requirements for Deepstack trainer. This installs torch 1.6.0

!pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f

Would be nice to use the newest version, but this works for now.


Ad3t0 - Your talking about a local install right? But we are getting the error with Google Colab on the cloud.

I have the same error regardless but in Colab it works for me successfully if I run that line after installing the requirements.

1 Like

Awesome! It’s working for me too, thanks so much Ad3t0 :slight_smile:

I was fighting with this for a few days until I found this thread. The most up-to-date version of PyTorch I found that still worked with the current deepstack-trainer code was 1.7.1.

pip3 install torch==1.7.1+cpu torchvision==0.8.2+cpu -f

Is there any news as to when we might be able to expect an update to the deepstack-trainer code to work with PyTorch 1.9.0 or at least the LTS 1.8.1 release?