I would like to summarize what I found by using Tensorflow (Keras) so far.
When installing Tensorflow in a virtual environment, it can be divided into cases where Anaconda's conda instruction and Python's pip instruction are used. Each feature is organized in the table below.
item | conda | pip |
---|---|---|
Installation command | conda install -c anaconda tensorflow-gpu | pip install --upgrade tensorflow |
merit | CUDA,cuDNN is also installed automatically. Super convenient! | 2020.As of 09 Tensorflow 2.3 pip install -r requirement.txt is very convenient |
Demerit | 2020.As of 09 Tensorflow 2.1 is the latest version. tensorflow-estimator Verison is 2.There is a case where it is 3.[2]At that time, conda install tensorflow-estimator==2.1.At 0, tensorflow-estimator version 2.1 manually installed |
CUDA,You need to install CuDNN yourself. It is said that the performance of Tensorflow with pip is worse than that with conda.[1] |
item | Tensorflow 1.X | Tensorflow 2.X |
---|---|---|
Installation | TensorflowとKerasを別々Installation | TensorflowだけInstallation |
import part | import tensorflow as tf import keras |
import tensorflow as tf import tf.keras |
As of September 2020, the version of Tensorflow on Google Colab is 2.3. But let's say the version of Tensorflow on your local machine is 2.1. At that time, you need to change the version of Tensorflow of Google Colab from 2.3 to 2.1.
#Enter into Google Colab
#Downgrade tensorflow
!pip install tensorflow-gpu==2.1
import tensorflow as tf
print(tf.__version__)
Recommended Posts