인공지능(AI)/TensorFlow

TensorFlow Error 2020/02/19

starcell 2020. 2. 19. 18:21

TensorFlow를 사용하다 보면 이래저래 에러를 만나게 된다.

내가 만난 에러들을 생각나는 대로 정리해 본다.

1) 가장 많은 것이 GPU 관련 에러인 것 같다.

cnn을 사용하는 경우 CPU 버전에서는 잘 돌던 코드가 GPU 버전에서는 안돈다.

-> version이 1.x 인 경우 아래를 추가 한다.

config = tf.ConfigProto()
config.gpu_options.allow_growth = True

 

2) GPU 메모리가 부족할 때 다음과 같은 에러가 발생한다.(실제 로그는 매우 길다. 관련 있는 것으로 짐작되는 라인이 아래와 같다.)

Resource exhausted: OOM when allocating tensor wi th shape[64,67,67,1024] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

--> 메모리에 맞게 데이터와 하이퍼파라미터 값을 조정해야 한다.

 

3) GPU 아키텍처와 CUDA Version이 맞지 않을 때 다음과 같은 에러가 발생한다.

INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InternalError'>, tensorflow/core/kernels/cuda_solvers.cc:803: cuBlas call failed status = 13

--> CUDA 버전을 바꾼다.

--> RTX(Turing Architecture)는 CUDA 9.x와 호환성에 문제가 있다. CUDA 10.x 이상을 사용한다.