How to change class indexing to start from 0 instead of 1?

Hi, I’m new to PyTorch and not a very experienced Python-programmer.

I’m trying to create my first image classification project from scratch and I have now encountered I problem. I have 3 classes as you can see in my Jupiter notebook file directory but for some reason they get indexed as 1,2,3 instead of 0,1,2 when I print the labels. As far as I understand this might be the reason why I get IndexError later because nn.CrossEntropyLoss expects values starting from 0 and not 1. The image below shows my Jupyter notebook and the beginning of the code:

Any suggestions? Is my file structure somehow incorrect or how I can change the indexing?

ImageFolder will create the class indices starting at 0, so I guess ./data_project/training contains at least 4 folders. You could print the train_dataset.classes and train_dataset.class_to_index for further debugging.