2017년 2월 26일 일요일

TensorFlow

TensorFlow

Reference

Versions

Tensorflow 1.3

  • As of Aug. 2017, Tensorflow 1.3 was released.

    • [CPU] $ pip3 install --upgrade tensorflow
    • [GPU] $ pip3 install --upgrade tensorflow-gpu

Tensorflow 1.0

  • As of Feb. 15, 2017, Tensorflow 1.0 was announced.
  • Python API stability
  • Speedup on multiple GPUs
  • tf.Keras
  • Installation improvements
  • [Experimental] XLA (Accelerated Linear Algebra) is a domain-specific compiler for linear algebra that optimizes TensorFlow computations. 
    • XLA currently supports JIT compilation on x86-64 and NVIDIA GPUs; and AOT compilation for x86-64 and ARM.

TFlearn guide

TensorFlow Installation (GPU)

  • 설치 환경(2017.05.30)
  • 1) CUDA 라이브러리 설치(v8.0)
    • https://developer.nvidia.com/cuda-downloads
      • linux -> x86_64 -> Ubuntu -> 16.04 -> deb(network)
      • 파일 다운로드 후 관련 명령어 수행
  • 2) cuDNN 다운로드(v.5.1)
    • https://developer.nvidia.com/cudnn
      • Nvidia 개발자 계정 필요
      • 다음 명령 실행
        • $ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
        • $ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
        • $ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
        • $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
  • 3) 다음 명령 실행
    • $ sudo apt-get install libcupti-dev
  • 4) pip3 설치
    • $ sudo apt-get install python3-pip python3-dev
      • $pip3 -V
  • 5) tensorflow-gpu 설치
    • $ pip3 install tensorflow-gpu # Python 3.n; GPU support
      • $ python3 -c 'import tensorflow as tf; print(tf.__version__)'
  • 기타
    • 실행시 SSE, AVX 등 warning 발생하는 것은 신경쓰지 않아도 됨. TF 소스 자체에서 build하면 해결된다고 하나, 굳이 놔두어도 상관없을 듯.
    • 상기 설치 후 system restart 한 번 해주면, graphic driver 잘 잡힐 듯.
    • IDE로는 py-charm 등 이용.
    • Performance Guide
      • NCHW image data format
    • Winograd conv algorithm 설정(3x3 행렬연산을 위한 tensor 성능 개선)
      • $ export TF_ENABLE_WINOGRAD_NONFUSED=1
    • # Couldn't open CUDA library libcupti.so.8.0. LD_LIBRARY_PATH
      • $ export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH

Library

  • tf.Transform
    • ML 전처리를 위한 TensorFlow 라이브러리 (Beam Preprocessing).
      • Users define a pipeline by composing modular Python functions, which tf.Transform then executes with Apache Beam, a framework for large-scale, efficient, distributed data processing. --> 그렇다면, 런타임(Serving)에 전처리를 위해서는 Apache Beam을 별도로 설치해야 하나? 
      • tf.Transform allows users to compute summary statistics for their datasets.
  • Edward
    • 확률 모델링, 추론을 위한 라이브러리.

댓글 없음:

댓글 쓰기