【发布时间】:2020-12-09 22:04:40
【问题描述】:
系统信息
- 操作系统:Windows 10,
- cudnn:8.0,
- CUDA 工具包:11.1 安装在 10.2 之上,
- GPU:Nvidia RTX 3070,
- CPU:英特尔 I7 10700f,
- Tensorflow:
tf.__version__==2.4.0rc-0(也曾在 2020 年 12 月 7 日尝试使用tf-nightly-gpu) - CUDA、cudnn 从源代码手动编译
测试代码
以下代码成功编译模型,但在调用model.fit(...) 时崩溃。
from tensorflow.keras import datasets, layers, models
import matplotlib.pyplot as plt
(train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data()
train_images, test_images = train_images / 255.0, test_images / 255.0
model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.Flatten())
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(10))
model.compile(optimizer='Adam', loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True))
history = model.fit(train_images, train_labels, batch_size=10, epochs=100)
通过移除 convolutional 和 maxpooling 层并在输入后将张量展平,模型能够很好地训练(显然这个模型的输出是无用的,但它是仍然可以训练)。
程序崩溃时的错误代码是>Process finished with exit code -1073740791 (0xC0000409)
此外,tensorflow 能够在调用tf.config.list_physical_devices('GPU') 时打开库、查找 GPU 并将 GPU 记录为可用
更新 我在 tensorflow github 页面上打开了一个问题,你可以找到 here
【问题讨论】:
-
这可能是一个错误,您知道 rc 表示候选发布版本,并且夜间构建不稳定吗?与其在这里提问,不如向 TensorFlow(在 github 中)报告一个错误,以便在最终 2.5 版本发布之前修复它。你也试过2.4版吗? (非 rc 之一)
-
rc=发布候选;是的,每晚=不稳定;是的。问题是最新的稳定版本(2.3.1)不支持安培架构(存在于 3000 系列 GPU 上),我将在 github 上报告这个问题,我只是想我也会在这里问,因为我'见过有人在 3000 系列 GPU 上成功运行 CNN,但大多数人使用的是 linux 发行版
-
不幸的是,Linux 是大多数深度学习框架中的一等公民,而 Windows 则被视为二等公民,也许这是 Windows 特定的错误,我也会尝试最新版本(甚至是 rc)。
-
感谢@Dr.Snoopy,我会试一试,看看是否会弹出任何新信息!
标签: python tensorflow keras gpu