본문 바로가기

반응형

pytorch

(6)
[mmcv] MMCV, MMDection 설치 종종 Github Project에서 MMCV 관련 라이브러리 설치 방법에 대해 적어놓지 않아서 여기에 기록해둔다. Install mmcv-full pip install -U openmim pip install chardet mim install mmcv-fullInstall MMDectection git clone https://github.com/open-mmlab/mmdetection.git cd mmdetection pip install -r requirements/build.txt pip install -v -e .
[error] RuntimeError: CUDA error: no kernel image is available for execution on the device 결론부터 말하면 GPU와 PC환경설정간 호환이 안된다는 뜻이다. 해결 방법은 아래에 흐름대로 적어놓도록 하겠다. 제목과 같은 에러메세지가 떴다. 지금 상황은 RTX3090으로 바꾸고 nvidia-driver, cuda, cudnn, anaconda, pytorch 설치 후 처음으로 러닝을 돌리는데 위와 같은 에러가 뜬 상황이다. 그 중 의도를 알 수 있는 메세지를 스샷했다. 대충 보니 파이토치 버전이 맞지 않는다는 의미인것 같았다. 일단 내 실험환경은 다음과 같다. NVIDIA-DRIVER : 460.39 CUDA : 11.2 CUDNN : 8.1.1 pytorch : 1.8.0 근데 의문인 것은 연구실 다른 분들 중에 CUDA 11.2, CUDNN 8.1.1 로 학습중인 분도 계셨고 NVIDIA-DRI..
[Error] TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not NoneType TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not NoneType 원인 : nn.Conv2d()에 input type으로 Tensor type이 들어가야 하는데 NoneType이 들어가고 있다는 말이다. 왜 NoneType이 들어가고 있는지 코드에서 확인해보아야 한다. self.layer2의 정의를 살펴보니 ResidualBlock 클래스의 내부를 보아야 했다. ResidualBlock class의 forward이다. 문제를 확인할 수 있겠는가? forward()의 return 을 설정해두지 않아서 NoneType 에러가 발생한 것이다. 해결법 : forward()에 return을 달아두자...
[error] RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same RuntimeError: Input type(torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same 원인 : 에러명에서도 알 수 있듯이 하나는 input type과 weight type이 동시에 cuda이어야 하는데 그게 아니라서 그렇다. 다시 말해 input type(x,y)는 cuda를 먹였는데 weight type(신경망)은 cuda를 먹이지 않아서 생기는 에러. 즉 x = x.to("cuda:0") y = y.to("cuda:0") 를 했지만 net.to("cuda:0") 를 하지 않아서 그렇다. 해결책 : net.to("cuda:0") 를 넣으면 된다.
[Error 기록] RuntimeError: Found 0 files in subfolders of: 자세한 에러 : RuntimeError: Found 0 files in subfolders of: /home/jsh/PycharmProjects/Torch_Exam/data/taco_and_burrito/train/ Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif,.tiff,.webp 해당 경로(/home/jsh/PycharmProjects/Torch_Exam/data/taco_and_burrito/train/)의 폴더가 비어있었기 때문에 에러가 났었다. 비어있던 이유는 train_imgs = ImageFolder(myPath+"/train", transform=transforms.Compose([ transforms.RandomCrop(22..
[Error 기록] RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same h = net(xx) 에서 에러가 났었다. 에러내용은 글의 제목과 같다. xx의 타입과 net의 weight타입이 다르다는건데 한참 헤매다가 코드실수라는걸 알았다. xx=xx.to(device) yy=yy.to(device) 처럼 써서 xx,yy를 GPU를 사용하게끔했어야 하는데 위의 사진처럼 써버려서 input은 cpu, network는 gpu를 쓰라고 명령했던 것이다.

반응형