바뀜
편집 요약 없음
=== 설치 ===
=== 설치 ===
설치가 까다로운 편이다. 요구하는 파이썬 버전 조건도 제한적이라 도커 안에서 다루는 편이 편할 것 같다.
설치가 까다로운 편이다. 요구하는 파이썬 버전 조건도 제한적이라 도커 안에서 다루는 편이 편할 것 같다.
==== 의존성 확인 ====
사용하는 버전이 안맞으면 계속 에러만 뜬다.
{| class="wikitable"
!tensorflow 버전
!알맞는 CUDA
|-
|2.4.x
|11.1
|-
|2.3.x
|10.1
|}
==== OS에 따른 설치 ====
{| class="wikitable"
{| class="wikitable"
!OS
!OS
# tensorflow가 요구하는 파이썬 버전 확인하고 다시 설치해준다.(https://www.tensorflow.org/install?hl=ko)
# tensorflow가 요구하는 파이썬 버전 확인하고 다시 설치해준다.(https://www.tensorflow.org/install?hl=ko)
# pip install --upgrade pip
# pip install --upgrade pip
# <code>pip install tensorflow</code>를 할 때 <code>ERROR: Could not find a version that satisfies the requirement tensorflow</code>가 뜬다면 파이썬이 64bit용이 아니기 때문이다.(텐서플로우는 64bit 기반)
#<code>pip install tensorflow</code>를 할 때 <code>ERROR: Could not find a version that satisfies the requirement tensorflow</code>가 뜬다면 파이썬이 64bit용이 아니기 때문이다.(텐서플로우는 64bit 기반)
# cpu stable 버전이 요구하는 넘파이 버전이 일정 미만일 수 있다.
# cpu stable 버전이 요구하는 넘파이 버전이 일정 미만일 수 있다.
|-
|-
|GPU사용준비
|GPU사용준비
|텐서플로우 2.4.1 기준으로 [https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal CUDA 10.1], [https://developer.nvidia.com/rdp/cudnn-archive cuDNN 7.6.4]를 설치해준다. CUDA는 그냥 설치하면 되고, cuDNN은 압축을 푼 후 내부의 파일들을 CUDA의 폴더에 복사해주면 된다. 기본경로는 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1 이다.
|
* 텐서플로우 버전에 맞게 [https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal CUDA], [https://developer.nvidia.com/rdp/cudnn-archive cuDNN]를 설치해준다. CUDA는 그냥 설치하면 되고, cuDNN은 CUDA에 맞는 것을 다운받아 압축을 푼 후 내부의 파일들을 CUDA의 폴더에 복사해주면 된다. 기본경로는 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v버전 형태이다.
* 시스템 환경변수 편집 -> 고급 -> 환경변수(Edit environment for your account)에서 system variables 중 CUDA_PATH가 있는지 확인.
|}
|}
|-
|-
</syntaxhighlight>
</syntaxhighlight>
|}
|}
=== 에러 ===
= 에러 =
== 패키지 버전관련 ==
{| class="wikitable"
{| class="wikitable"
!에러
!에러
|Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
|Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
|2.1버전 이후부터 패키지에 CPU, GPU버전이 모두 설치된다.
|2.1버전 이후부터 패키지에 CPU, GPU버전이 모두 설치된다.
GPU 도구가 설치되지 않았을 때 발생.
|
|
* CPU버전으로 실행(무시하고 진행하면 CPU버전으로 실행한다. 텐서플로우를 임포트 하기 전, 코드 상단에 os를 임포트하고 os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'를 넣어주면 에러메시지도 없앨 수 있다. 부작용으로... 에러메시지를 못본다.(기본적인 에러메시지는 뜬다.))
* CPU버전으로 실행(무시하고 진행하면 CPU버전으로 실행한다. 텐서플로우를 임포트 하기 전, 코드 상단에 os를 임포트하고 os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'를 넣어주면 에러메시지도 없앨 수 있다. 부작용으로... 에러메시지를 못본다.(기본적인 에러메시지는 뜬다.))
* GPU를 사용할 수 있는 환경 갖추기.(위 설치 참고.)
* GPU를 사용할 수 있는 환경 갖추기.(위 설치 참고.)
|-
|위와 같은 에러
W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
|의존성 문제. ㅅㅂ..
|CUDA10.1을 사용하고 있다면 pip install tensorflow==2.3.0을 사용하고,
tensorflow가 2.4.0 이라면 CUDA11.0 으로 올려야 한다.
|-
|-
|AttributeError: module 'tensorflow' has no attribute 'Session'
|AttributeError: module 'tensorflow' has no attribute 'Session'