python-使用GPU时tensorflow和CUDA失败,进程结束,退出代码为1073740791(0xC0000409)
发布时间:2022-05-09 21:43:36 689
相关标签: # node.js
我第一次尝试使用我的GPU运行Tensorflow模型,每当培训开始时,它就会退出,并显示以下消息:
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)
我的设置:
GTX 1650
tensorflow 2.7.0
CUDA 11.5
cudNN 8.3.3
Python 3.8.0
以下是模型和预处理:
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)
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报