How to run ptb_word_lm.py

古いバージョンの 0.12.1 の頃は models が同梱されていたのでこれを使う。現在は tensorflow/tensorflow と tensorflow/models に分かれてしまったのでバージョンミスマッチなどで全然動かない。

sudo -H pip install tensorflow-0.12.1-cp35-cp35m-macosx_10_11_x86_64.whl
python ptb_word_lm.py --data_path=~/Dropbox/TensorFlow/simple-examples/data

below didn't work **

version 確認する

>>> import tensorflow as tf
>>> tf.__version__
'0.12.1'
>>> 

0.12.1 よりも nightly build で example を走らせよと書いてあるので。
https://github.com/tensorflow/tensorflow/archive/v1.0.0-rc1.zipをダウンロード。

% brew cask install java
% brew install bazel
$ sudo easy_install -U six
$ sudo easy_install -U numpy
$ sudo easy_install wheel
$ sudo easy_install ipython
% cd tensorflow-1.0.0-rc1/ 
% ./configure # だいたいデフォルトの y/n で答える
% bazel build --config opt //tensorflow/tools/pip_package:build_pip_package
% bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.0rc1-cp35-cp35m-macosx_10_6_x86_64.whl
>>> import tensorflow as tf
>>> tf.__version__
'1.0.0-rc1
% wget https://github.com/tensorflow/models/archive/master.zip
% cd models-master/tutorials/rnn/ptb
% brew cask install java
% brew install bazel
$ sudo easy_install -U six
$ sudo easy_install -U numpy
$ sudo easy_install wheel
$ sudo easy_install ipython

Download tensorflow-master.zip
unzip it
cd tensorflow-master.zip
% ./configure
Please specify the location of python. [Default is /Users/higepon/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/bin/python]: 
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] 
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] 
No Hadoop File System support will be enabled for TensorFlow
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] 
No XLA support will be enabled for TensorFlow
Found possible Python library paths:
  /Users/higepon/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages
Please input the desired Python library path to use.  Default is [/Users/higepon/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages]

Using python library path: /Users/higepon/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages
Do you wish to build TensorFlow with OpenCL support? [y/N] 
No OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N] 
No CUDA support will be enabled for TensorFlow
Configuration finished

% bazel build --config opt //tensorflow/tools/pip_package:build_pip_package
% bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
$ sudo pip install /tmp/tensorflow_pkg/tensorflow-0.12.1-cp35-cp35m-macosx_10_6_x86_64.whl

above didn't work

ImportError: dlopen(/Users/higepon/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/_pywrap_te
nsorflow.so, 10): Symbol not found: ___cpu_model

https://github.com/tensorflow/tensorflow/issues/7223