Image Inpainting Task를 하다 Setting up PyTorch plugin "upfirdn2d_plugin"... 문제에 직면했다.
구글링 해보니 stylegan2 에서 종종 발생하는 문제인가보다..
MAT
https://github.com/fenglinglwb/MAT
GitHub - fenglinglwb/MAT: MAT: Mask-Aware Transformer for Large Hole Image Inpainting
MAT: Mask-Aware Transformer for Large Hole Image Inpainting - GitHub - fenglinglwb/MAT: MAT: Mask-Aware Transformer for Large Hole Image Inpainting
github.com
나는 MAT 모델을 이용해서 Image Inpainting을 test 중인데 stylegan2를 참조하는듯 하다.
해당 모델의 requirements와 데이터셋을 모두 맞추고 generate_image.py 을 실행시키면 다음과 같은 화면이 나온다.
Setting up PyTorch plugin "upfirdn2d_plugin"... 이 출력된 뒤로 아무리 기다려도 응답이 없다.
Failed! 라는 글자라도 뜨면 뭐가 안되나보다.. 할텐데 그냥 응답이 없다.
뭔가 내부적으로 일은 하고 있겠지만 보여주지 않으니 뭘 하는지 알 수도 없다..ㅎㅎ
구글링 하면서 찾은 해결 방법들을 적어본다.
해결 방법
1. pip install ninja
https://github.com/NVlabs/stylegan2-ada-pytorch/issues/39
upfirdn2d_plugin Problem · Issue #39 · NVlabs/stylegan2-ada-pytorch
Describe the bug Setting up PyTorch plugin "upfirdn2d_plugin"... Failed! Please stop closing people's issues without a confirmed fix for this problem. #2 (comment) does not work and t...
github.com
위 깃헙 issues를 읽어보니 일단 ninja 를 깔아보라고 한다.
하지만 나는 여전히 실행 되지 않았다.
2. CUDA 버전 변경
깃헙에는 pytorch 1.7.1 과 cudatoolkit 11.0 이 필요하다고 했지만..
그렇게 설치했는데 안된다구!!! 어쩔 수 없이 맞는 CUDA 버전을 찾아 나섰다.
- pytorch v 1.11.0
# CUDA 11.3
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
이거 설치 했더니 실행 되었다.
이유는.... cudatoolkit 버전이 내 데스크탑과 맞았기 때문이라고 추측되는데 확실하지는 않다.
역시 이것 저것 하다보면 해결된다..ㅎ
이게 실행 된 덕분에 추가적인 실험을 할 수 있었다.
원본 사진에서 마스크 영역만 없애고 복원 하면 어떻게 될까 실험을 해봤는데, 결과만 살짝 보여주자면
원본 사진 | 마스크 | 복원 결과 |
![]() |
![]() |
![]() |
이정도!
'Python' 카테고리의 다른 글
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. (0) | 2023.01.31 |
---|---|
[Python] 2차원 리스트 원소 별로 합치는 방법 (0) | 2023.01.25 |
[Conda] 콘다 업데이트의 위험성.. / CondaSSLError: OpenSSL (0) | 2022.12.20 |
[PyTorch] CUDA capability sm_86 is not compatible with the current PyTorch installation (0) | 2022.12.12 |
경로 내의 파일명 가져오는 방법 (0) | 2022.07.15 |