jupyter notebook中使用tensorflow-gpu常常出現的問題

問題1:

Kernel Restarting The kernel appears to have died. It will restart automatically

解決方法:

如果是在裝有GPU的服務器上搭建的jupyter notebook,並且使用的tensorflow可以通過在session的前面加上config來解決這個問題,親自試過可行(我覺得主要問題是在此之前都是在cpu上運行的程序,造成內存不足,所以導致的kernel died,如果查看在代碼運行的時候內存佔用情況可以使用free -h):

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

問題2:

WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/layers/core.py:143: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.

WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.Instructions for updating: Use tf.cast instead.

WARNING:tensorflow:From /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_grad.py:102: div (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Deprecated in favor of operator or tf.math.divide.

解決方法:

發生這種問題的主要原因可能是anaconda版本問題,或者是其他版本問題造成的版本不兼容。使用以下指令進行相應的更新。親自嘗試可行。

conda update mkl
conda upgrade notebook
conda upgrade jupyter
conda update anaconda

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章