This error shows me in engine.py
in function train_one_epoch()
, but I think that I don’t need to change this script. Because of function _get_image_size()
in transforms.py
I was downgrade torchvision to 0.10.0 and torch = 1.10.0 but now this error shows me and I don’t know if the problem is because of versions or something else ?
I followed this tutorial TorchVision Object Detection Finetuning Tutorial — PyTorch Tutorials 2.2.0+cu121 documentation and I’m wondering which versions are used here ?
Traceback (most recent call last):
File "/home/landeka/Nezz/Model1.py", line 271, in <module>
main()
File "/home/landeka/Nezz/Model1.py", line 262, in main
train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq=10)
File "/home/landeka/Nezz/vision/references/detection/engine.py", line 28, in train_one_epoch
targets = [{k: v.to(device) for k, v in t.items()} for t in targets]
File "/home/landeka/Nezz/vision/references/detection/engine.py", line 28, in <listcomp>
targets = [{k: v.to(device) for k, v in t.items()} for t in targets]
File "/home/landeka/Nezz/vision/references/detection/engine.py", line 28, in <dictcomp>
targets = [{k: v.to(device) for k, v in t.items()} for t in targets]
AttributeError: 'int' object has no attribute 'to'