I was addicted to machine learning using tensorflow, so I will describe it.
environment | version |
---|---|
OS | Windows |
tensorflow | 2.3.0 |
CUDA | 11.0 |
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(512, activation=tf.nn.relu),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)
When trying to execute code like the one above
F .\tensorflow/core/kernels/random_op_gpu.h:232] Non-OK-status: GpuLaunchKernel(FillPhiloxRandomKernelLaunch<Distribution>, num_blocks, block_size, 0, d.stream(), gen, data, size, dist) status: Internal: invalid configuration argument
Error occurred and it became impossible to execute.
This error
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
It was possible to avoid it by setting it not to use GPU. I thought it was caused by CUDA and tried downloading it again and reviewing the path settings, but the result did not change ...
pip install tf-nightly-gpu
I was able to solve it.
Apparently I thought it was tf-nightly-gpu
, but it seemed to be the latest version of tensorflow and newer than 2.3.0.
pip list
When I look it up in
tf-estimator-nightly 2.4.0.dev2020091501
tf-nightly-gpu 2.4.0.dev20200912
It seemed to be in the development stage.
I didn't know why this solved the error ...
https://itips.krsw.biz/tensorflow-keras-gpu-deactivate/ https://github.com/tensorflow/tensorflow/issues/30665
Recommended Posts