Remote configuration tensorflow environment

1. In order to compare the method of others, need to configure the environment: Python 3.6.4, Keras 2.1.6, Tensorflow 1.7.0

On their computers, anaconda3, directly tensorflow-gpu1.13.1 under the original environment found in most parts of the code segment starting run, but can not save the model code snippet does not work, resulting in an error.

 callbacks=[ModelCheckpoint(filepath=filepath_INCV, monitor='val_acc', verbose=1, save_best_only=INCV_save_best),

He had sought to install a virtual environment, prepare exactly the same settings.

 

2. opened a new virtual environment, tf1.7.0, beginning not installed successfully, it seems to be the choice of python version does not correspond exactly to delete the environment and then start again, a success. If it seems with conda install tensorflow-gpu = 1.7.0 command-line installation tensorflow, cuda9.0 toolkit will automatically install the required packages and cudadnn.

Then run import tensorflow as tf pandas will be reported missing and the like numpy package, followed by the installation like conda install, which is automatically installed corresponding to the versions available.

When import tensorflow, also reported

/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:460: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:461: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:465: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

But this is not a big problem, you can modify, you can not change.

2019-12-24 10:12:41.915407: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915435: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915442: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915447: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915469: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

This is not a big problem, it may change or may not change.

After installing keras, found that a small bug, keras tensorflow incompatible with reference  https://ask.csdn.net/questions/687001  the tf.nn.softmax (*, axis = axis) into dim = axis, and then repaired.

softmax() got an unexpected keyword argument 'axis'

 

3. arranging the environment on the remote server Ubuntu18.04

This is actually a bit trickier, because tensorflow-gpu 1.7.0 requires cuda9.0 version and the original version cuda9.0 only supports installation on ubuntu 16.04 and ubuntu17.10. https://blog.csdn.net/hellocsz/article/details/88372819  pointed python3.6.4 correspond anaconda3-5.1.0, then from  https://mirrors.tuna.tsinghua.edu.cn  download the corresponding version of the anaconda.

https://blog.csdn.net/qq_27825451/article/details/89082978  noted (text and explained in detail cuda, cudnn and graphical driver (relationship between the graphics driver))

tensorflow_gpu-1.7.0    python 2.7、  python 3.3-3.6    GCC 4.8    Bazel 0.9.0    cudnn 7   cuda 9

Cuda9.2 and download a patch file from nvidia's official website (Since there is no corresponding Ubuntu 18.04, then download Ubuntu 17.10, but the following blog, seems to download the corresponding ubuntu16.04 might be better), then the corresponding simultaneous downloads cudnn file

The ubuntu18.04 of gcc (g ++) compiler and kernel versions are too high, causing some possible problems. A paper in accordance with (  https://www.jianshu.com/p/00c37b09f0f3  ) and its further link  https://www.jianshu.com/p/f66eed3a3a25  switched gcc (g ++) version.

Then follow the instructions. Cuda9.2 A further text, the first selected graphics driver installation, but reported the following errors:

Installing the NVIDIA display driver...
The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly.
If you know that the kernel source packages are installed and set up correctly, you may pass the location of the kernel source with the '--kernel-source-path' flag.

===========
= Summary =
===========

Driver:   Installation Failed
Toolkit:  Installation skipped
Samples:  Not Selected

Check some other blog says the kernel version is too high,

https://askubuntu.com/questions/829890/nvidia-driver-install-fails-unable-to-locate-the-kernel-source

https://blog.51cto.com/xiaoxiaozhou/2344649?source=dra


2cto.com/net/201904/804672.html

https://blog.csdn.net/net_wolf/article/details/100178800

 

The need to reduce kernel version, but I find it too little too cumbersome, and A text also did not mention this. So luck, I tried it, and this time did not choose to install the graphics driver.

The strange thing is this time actually toolkit installation was successful. Could kernel version too only affects the graphics driver? Does not affect cuda toolkit? It is not yet very clear

Installation cudnn v7.4, the strange thing is that the name is actually downloaded cudnn-9.2, should be to be consistent and cuda version number. According to  https://blog.csdn.net/fengliang4616/article/details/90142747  settings like

So further installation anaconda, anaconda attention version of choice to ensure that the default version of Python installed Python version is required, other just fine with default settings.

 

 

Strange! Remote server actually can be networked, and use conda install tensorflow-gpu = 1.7.0, and actually reinstall Python, cudnn, cuda toolkit

Downloading and Extracting Packages
xz 5.2.4: ############################################################## | 100% 
pip 19.3.1: ############################################################ | 100% 
python 3.6.6: ########################################################## | 100% 
absl-py 0.8.1: ######################################################### | 100% 
libedit 3.1.20181209: ################################################## | 100% 
tensorflow-gpu 1.7.0: ################################################## | 100% 
cupti 9.0.176: ######################################################### | 100% 
openssl 1.0.2t: ######################################################## | 100% 
libprotobuf 3.6.0: ##################################################### | 100% 
bleach 1.5.0: ################################################# ######### | 100 %  
cudnn 7.6 . 4 : ################################################ ########### | 100 %  
certifi 2,019.11 . 28 : ################################################ #### | 100 %  
sqlite 3.30 . 1 : ################################################ ######### | 100 %  
readline 7.0 : ############################################# ############# | 100 %  
libgcc -a 9.1 . 0: ################################################# ###### | 100 %  
cudatoolkit 9.0 : ############################################# ########## | 100 %  
approx -certificates 2019.11 . 27 : ################################################ ################################################## ################################################## #################### | 100 %  
tool- 00:16 . 0 : ################################################ ################################################## ################################################## ############################### | 100 % 
grpcio 1:12 . 1 : ################################################ ################################################## ################################################## ################################# | 100 %  
protobuf 3.6 . 0 : ################################################ ################################################## ################################################## ################################ | 100 %  
zlib 1.2 . 11 : ################################################ ################################################## ################################################## ################################### |100% 
_libgcc_mutex 0.1: ################################################################################################################################################################################# | 100% 
numpy 1.14.2: ###################################################################################################################################################################################### | 100% 
astor 0.8.0: ################################################# ################################################## ################################################## ################################## | 100 %  
guest 0.3 . 2 : ################################################ ################################################## ################################################## #################################### | 100 %  
html5lib 0.9999999 : ############################################# ################################################## ################################################## ############################### | 100 %  
markdown 3.1 .1: #################################################################################################################################################################################### | 100% 
setuptools 42.0.2: ################################################################################################################################################################################# | 100% 
blas 1.0: ########################################################################################################################################################################################## | 100% 
wheel 0.33.6: ###################################################################################################################################################################################### | 100% 
tensorflow-gpu-base 1.7.0: ######################################################################################################################################################################### | 100% 
tk 8.6.8: ########################################################################################################################################################################################## | 100% 
six 1.13.0: ######################################################################################################################################################################################## | 100% 
termcolor 1.1.0: ################################################################################################################################################################################### | 100% 
tensorboard 1.7.0: ################################################################################################################################################################################# | 100% 
ncurses 6.1: ####################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Then install keras-2.1.6 Online

root@ubuntu:~/anaconda3# conda install keras=2.1.6
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.10
  latest version: 4.8.0

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: /root/anaconda3

  added / updated specs: 
    - keras=2.1.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    tensorflow-base-1.7.0      |   py36hdbcaa40_2        38.7 MB
    keras-2.1.6                |           py36_0         500 KB
    tensorflow-1.7.0           |                0           3 KB
    ------------------------------------------------------------
                                           Total:        39.2 MB

The following NEW packages will be INSTALLED:

    keras:           2.1.6-py36_0        
    tensorflow:      1.7.0-0             
    tensorflow-base: 1.7.0-py36hdbcaa40_2

Proceed ([y]/n)? y


Downloading and Extracting Packages
tensorflow-base 1.7.0: ############################################################################################################################################################################# | 100% 
keras 2.1.6: ####################################################################################################################################################################################### | 100% 
tensorflow 1.7.0: ################################################################################################################################################################################## | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

 

 

 

 

# to be continued

Guess you like

Origin www.cnblogs.com/Gelthin2017/p/12094276.html