Programming/General

[YOLOv7] training 중 indices should be either on cpu or on the same device as the indexed tensor (cpu) 에러 발생 해결법

MVP 2022. 12. 28. 18:00

1. 증상

Training YOLOv7 on Custom Data - Colaboratory (google.com)

 

Training YOLOv7 on Custom Data

Colaboratory notebook

colab.research.google.com

colab에서 training을 할려고 할 때  indices should be either on cpu or on the same device as the indexed tensor (cpu)

과 같은 에러 메시지 발생

 

2. 해결 방법

다음 커맨드를 실행하여 pytorch의 버전을 다운그레이드 하면 됨

 

!pip install torch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 torchtext==0.13.1

 

해결됐으면 공감을 클릭해주세요. 만약 해결되지 않았으면 코멘트를 달아주시면 확인하겠습니다.