export CUDA_ROOT=/usr/local/cuda export CUDA_PATH=/usr/local/cuda export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib export LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib:$LIBRARY_PATH: export CPATH=/usr/local/cuda/include:$CPATH export CUDA_INC_DIR=/usr/local/cuda/bin:$CUDA_INC_DIR
from keras.models import model_from_json f = open("json.sav","r") jsonData = json.load(f) # dict format model = model_from_json(json.dumps(jsonData)) model.load_weights("weights.h5")参考: Keras models(モデルのsave/load)
$ sudo python2.7 -m pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl tensorflow-0.5.0-cp27-none-linux_x86_64.whl is not a supported wheel on this platform.というメッセージが出た。pipは最新版でPytho2.7を使っているので、 不思議だったが、解決したのでここに記す:
sudo python2.7 -m pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
import tensorflow as tf from keras.backend import tensorflow_backend config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)) session = tf.Session(config=config) tensorflow_backend.set_session(session)
# デバイス確認 $ ubuntu-drivers devices # 自動でドライバをインストール $ sudo ubuntu-drivers autoinstall # 再起動 $ sudo reboot再起動後、