'Utilizing GPU fails with tensorflow and CUDA with process finished with exit code -1073740791 (0xC0000409)
I try to use my GPU for the first time to run a model with Tensorflow it exits whenever training starts with message:
Epoch 1/15
2022-05-07 00:46:23.749793: I tensorflow/stream_executor/cuda/cuda_dnn.cc:366] Loaded cuDNN version 8303
Process finished with exit code -1073740791 (0xC0000409)
My setup:
GTX 1650
tensorflow 2.7.0
CUDA 11.5
cudNN 8.3.3
Python 3.8.0
Here is the model and the preprocessing:
model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(16, (3,3), activation='relu', input_shape=(150, 150, 3)),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(32, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Conv2D(64, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dense(1, activation='sigmoid')
])
model.compile(loss='binary_crossentropy',
optimizer=RMSprop(learning_rate=0.001),
metrics=['accuracy'])
from tensorflow.keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(rescale=1 / 255)
validation_datagen = ImageDataGenerator(rescale=1 / 255)
train_generator = train_datagen.flow_from_directory(
'./horse-or-human/', # This is the source directory for training images
target_size=(150, 150), # All images will be resized to 150x150
batch_size=128,
# Since you used binary_crossentropy loss, you need binary labels
class_mode='binary')
validation_generator = validation_datagen.flow_from_directory(
'./validation-horse-or-human/', # This is the source directory for training images
target_size=(150, 150), # All images will be resized to 150x150
batch_size=32,
# Since you used binary_crossentropy loss, you need binary labels
class_mode='binary')
history = model.fit(
train_generator,
steps_per_epoch=8,
epochs=15,
verbose=1,
validation_data=validation_generator,
validation_steps=8)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
