(py35) C:\work>pip install tensorflow-gpu==1.15.0
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting tensorflow-gpu==1.15.0
Using cached tensorflow-gpu-1.15.0-cp35-cp35m-win_amd64.whl (294.5 MB)
Requirement already satisfied: grpcio>=1.8.6 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.34.1)
Requirement already satisfied: protobuf>=3.6.1 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (3.14.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.1.2)
Requirement already satisfied: keras-applications>=1.0.8 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.0.8)
Requirement already satisfied: wheel>=0.26 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (0.31.1)
Requirement already satisfied: astor>=0.6.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (0.7.1)
Requirement already satisfied: absl-py>=0.7.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (0.11.0)
Requirement already satisfied: six>=1.10.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.15.0)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.18.5)
Requirement already satisfied: termcolor>=1.1.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorflow-gpu==1.15.0) (1.1.0)
Collecting gast==0.2.2
Using cached gast-0.2.2-cp35-none-any.whl
Collecting tensorflow-estimator==1.15.1
Using cached tensorflow_estimator-1.15.1-py2.py3-none-any.whl (503 kB)
Collecting google-pasta>=0.1.6
Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB)
Requirement already satisfied: h5py in c:\programdata\anaconda3\envs\py35\lib\site-packages (from keras-applications>=1.0.8->tensorflow-gpu==1.15.0) (2.7.1)
Collecting opt-einsum>=2.3.2
Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB)
Collecting tensorboard<1.16.0,>=1.15.0
Using cached tensorboard-1.15.0-py3-none-any.whl (3.8 MB)
Requirement already satisfied: setuptools>=41.0.0 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu==1.15.0) (50.3.2)
Requirement already satisfied: markdown>=2.6.8 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu==1.15.0) (3.2.2)
Requirement already satisfied: werkzeug>=0.11.15 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu==1.15.0) (0.14.1)
Requirement already satisfied: importlib-metadata in c:\programdata\anaconda3\envs\py35\lib\site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow-gpu==1.15.0) (2.1.1)
Collecting wrapt>=1.11.1
Using cached wrapt-1.12.1-cp35-none-any.whl
Requirement already satisfied: zipp>=0.5 in c:\programdata\anaconda3\envs\py35\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow-gpu==1.15.0) (1.2.0)
Installing collected packages: wrapt, tensorflow-estimator, tensorboard, opt-einsum, google-pasta, gast, tensorflow-gpu
Attempting uninstall: wrapt
Found existing installation: wrapt 1.10.11
ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
File "01)sin_lstm.py", line 64, in
model.add(LSTM(HIDDEN_SIZE , input_shape=(SEQLEN, nb_chars), return_sequences=True))
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\engine\sequential.py", line 166, in add
layer(x)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\layers\recurrent.py", line 541, in __call__
return super(RNN, self).__call__(inputs, **kwargs)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\backend\tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\engine\base_layer.py", line 446, in __call__
self.assert_input_compatibility(inputs)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\engine\base_layer.py", line 310, in assert_input_compatibility
K.is_keras_tensor(x)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\backend\tensorflow_backend.py", line 695, in is_keras_tensor
if not is_tensor(x):
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\backend\tensorflow_backend.py", line 703, in is_tensor
return isinstance(x, tf_ops._TensorLike) or tf_ops.is_dense_tensor_like(x)
AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'
【原 因】
① 暗黙の変更
python3.5動作試験では「tensorflow1.14」は使用不可になっていることから、仕様に暗黙の変更があるように思えます。
② 「conda」「pip」を交互に行ってインストール
「conda」と「pip」とではインストール後出来上がったファイル名が異なったり、「tensorflow」「tensorflow-gpu」の2つが出来上がったりすることから、インストール内容が異なっているようです。
このため、「conda」と「pip」を混合でインストールしてはいけないのではないかと思われます。
2021-01-21 11:50:42.616611: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2021-01-21 11:50:42.723114: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 1650 major: 7 minor: 5 memoryClockRate(GHz): 1.665
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.25GiB
2021-01-21 11:50:42.723284: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2021-01-21 11:50:43.040345: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-01-21 11:50:43.040431: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0
2021-01-21 11:50:43.040849: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N
2021-01-21 11:50:43.040996: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2939 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
【python バージョン3.6】
Using TensorFlow backend.
2021-01-21 11:52:06.548964: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-21 11:52:15.443721: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-01-21 11:52:15.475319: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.665GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-01-21 11:52:15.475407: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-21 11:52:16.275206: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
【python バージョン3.7】
2021-01-22 03:33:41.082066: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2021-01-22 03:33:41.084516: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2021-01-22 03:33:41.106653: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1650 major: 7 minor: 5 memoryClockRate(GHz): 1.665
pciBusID: 0000:01:00.0
2021-01-22 03:33:41.106749: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2021-01-22 03:33:41.107072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2021-01-22 03:33:41.503008: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-01-22 03:33:41.503085: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
2021-01-22 03:33:41.503791: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
2021-01-22 03:33:41.504242: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2931 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\py37\lib\site-packages\keras\backend\tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.
>python 05)econs_stateful.py
Using TensorFlow backend.
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:516: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:517: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:518: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:519: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:520: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:525: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: 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)])
C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: 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)])
(98179, 20, 1) (42077, 20, 1) (98179, 1) (42077, 1)
2021-01-22 11:25:05.333358: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2021-01-22 11:25:05.335580: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2021-01-22 11:25:05.362353: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1650 major: 7 minor: 5 memoryClockRate(GHz): 1.665
pciBusID: 0000:01:00.0
2021-01-22 11:25:05.362453: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2021-01-22 11:25:05.362787: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2021-01-22 11:25:05.757109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-01-22 11:25:05.757173: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
2021-01-22 11:25:05.757835: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
2021-01-22 11:25:05.757989: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2931 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\keras\backend\tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.
Train on 98179 samples, validate on 42077 samples
Epoch 1/5
98179/98179 [==============================] - 16s 165us/step - loss: 0.0091 - mean_squared_error: 0.0091 - val_loss: 0.0039 - val_mean_squared_error: 0.0039
py36_t20
(py36_t20) C:\VisualStudio2017\Python3.5_GPU\Keras_text\ch6>python 05)econs_stateful.py
Using TensorFlow backend.
2021-01-22 10:52:54.585035: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
(98179, 20, 1) (42077, 20, 1) (98179, 1) (42077, 1)
2021-01-22 10:52:59.321663: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-01-22 10:52:59.345313: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.665GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-01-22 10:52:59.345399: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-22 10:52:59.350188: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-01-22 10:52:59.353302: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-01-22 10:52:59.354478: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-01-22 10:52:59.357903: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-01-22 10:52:59.359823: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-01-22 10:52:59.368019: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-01-22 10:52:59.368859: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0
2021-01-22 10:52:59.369673: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2021-01-22 10:52:59.372148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.665GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-01-22 10:52:59.372270: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-22 10:52:59.372559: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-01-22 10:52:59.372718: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-01-22 10:52:59.372917: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-01-22 10:52:59.373087: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-01-22 10:52:59.373261: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-01-22 10:52:59.373458: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-01-22 10:52:59.373683: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0
2021-01-22 10:52:59.781543: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-01-22 10:52:59.781633: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] 0
2021-01-22 10:52:59.782203: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0: N
2021-01-22 10:52:59.782386: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2919 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
Train on 98179 samples, validate on 42077 samples
Epoch 1/5
2021-01-22 11:27:49.047859: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
98179/98179 [==============================] - 12s 120us/step - loss: 0.0188 - mean_squared_error: 0.0188 - val_loss: 0.0040 - val_mean_squared_error: 0.0040