728x90

Python_Error 6

에러 해결: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.

해당 에러 발생 환경: PyCharm, numpy(1.22.2), python 3.9.7 해결 출처: https://stackoverflow.com/questions/44574679/python-deprecationwarning-elementwise-comparison-failed-this-will-raise-an Python: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future I came across a problem with comparing the predictions of my model with the labels of training set. The arrays I'm using..

Python_Error 2022.03.06

에러 해결: RuntimeError: CUDA error: device-side assert triggered

해당 에러는 구글링해서 알아보니 다양한 원인에 의해서 발생하는 것 같다. 해당 에러가 발생하는 하나의 예시 및 그에 대한 해결로 보면 좋겠다. 우선 나의 경우, Pytorch에서 BCE Loss로 Autoencoder를 학습하다가 난 에러이고, 개발 환경은 JupyterNotebook이다. 해당 에러는 CUDA에서 발생한 에러이기 때문에 torch.device를 'cuda:0'로 하지 않고, 'cpu'로 하는 경우, 구체적으로 어떤 에러가 발생했는지 더 정확한 설명이 나온다. 그렇게 한 후 다시 코드를 실행해보면, 나 같은 경우에는 다음과 같은 에러 메시지가 나타났다. RuntimeError: all elements of input should be between 0 and 1 이 에러는 BCE Loss..

Python_Error 2020.12.07

에러 해결: Expected object of scalar type Float but got scalar type Double for argument #2 'mat1' in call to _th_addmm

딥러닝 모델에 입력을 넣을 때 발생한 에러이다. 단순한 딥러닝 모델을 학습시킬 때, 이미지 같은 데이터가 아닌 그냥 숫자를 넣기 위해서 직접 numpy에서 난수를 발생시켜 dataset을 구성했다. 학습하는 코드에서 model에 해당 dataset을 입력으로 넣을 때 아래와 같은 에러메시지가 발생했다. RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #2 'mat1' in call to _th_addmm float type의 객체가 들어올 줄 알았는데 double type의 객체가 들어왔다는 에러였다. tensor 자료형인 dataset을 출력해봤더니 tensor 마지막에 'dtype=tor..

Python_Error 2020.12.04

Python 딥러닝 모델 호출 시 에러: torch.nn.modules.module.ModuleAttributeError: 'Model' object has no attribute '_non_persistent_buffers_set'

torch.nn.modules.module.ModuleAttributeError: 'Model' object has no attribute '_non_persistent_buffers_set' python에서 pytorch 라이브러리를 이용해 딥러닝 모델을 만들고 해당 모델을 돌릴 때 발생하는 에러다. 알아보니 pytorch 버전이 1.6.x일 때 발생하는 에러다. pytorch 버전을 1.5.1로 downgrade하면 해당 에러가 해결된다. python 버전이 3.8로 상향되면서 pytorch에서 라이브러리를 설치할 때 자동으로 1.6.x 버전이 설치된다. 때문에 pytorch 설치 후 다시 downgrade를 해야 해당 에러가 발생하지 않는다. pytorch를 downgrade하는 방법은 pytorc..

Python_Error 2020.09.23

Pytorch 설치 시 주의 사항(ERROR: Failed building wheel for torch 에러 해결)

cmd 창에 >> python -m pip install torch 명령으로 pytorch를 설치하려고 하면 아래와 같은 에러가 발생하는 문제가 있다. ERROR: Failed building wheel for torch 해결 방법 pytorch의 경우 python -m pip install torch 명령으로 설치하는 것이 아니라, https://pytorch.org PyTorch An open source deep learning platform that provides a seamless path from research prototyping to production deployment. pytorch.org 링크로 들어가서 명령문을 찾아야 한다. 해당 링크로 들어가면 위 화면이 나타나고 맞는 사양..

Python_Error 2020.06.17

Process finished with exit code -1073741819 (0xC0000005)

개발 환경 Pycharm Python: 3.7 pytorch: 1.3.1 cuda: 10.2 문제: MLP 설계 시에는 문제 없이 돌아가는데 CNN으로 하는 경우 위 해당 코드가 나오면서 코드 실행이 중단된다. 시도(해당 에러 코드를 검색해보면 메모리 접근 위반이라는데 이렇다할 해결 방법은 찾지 못했다.) - CUDA-CuDNN를 다시 설치해도 해결되지 않는다. - Tensorflow를 이용한 CNN 코드를 Pycharm에서도 돌리면 문제없이 작동한다. - 같은 코드를 colab에서 돌리면 정상적으로 작동한다. - 같은 코드를 jupyter notebook에서 돌리면 정상적으로 작동한다. 결론(미해결) -> 코드에는 문제가 없어 보이고 Pycharm에서 설정 문제일 수도 있겠지만, 구글에 검색해도 나오지..

Python_Error 2020.05.25
728x90