Python 系统在人工神经网络训练中途失效
在ANN训练的中途,代码突然停止或导致BSoD 代码如下:Python 系统在人工神经网络训练中途失效,python,tensorflow,pycharm,Python,Tensorflow,Pycharm,在ANN训练的中途,代码突然停止或导致BSoD 代码如下: import tensorflow as tf from tensorflow import keras from keras.models import Sequential from keras.layers import Dense,Flatten from keras.optimizers import adam from keras.activations import relu,softmax dataset = kera
import tensorflow as tf
from tensorflow import keras
from keras.models import Sequential
from keras.layers import Dense,Flatten
from keras.optimizers import adam
from keras.activations import relu,softmax
dataset = keras.datasets.fashion_mnist
(train_images,train_labels),(test_images,test_labels) = dataset.load_data()
train_images = train_images / 255.0
test_images = test_images / 255.0
class_names = [
"T-shirt/top",
"Trouser",
"Pullover",
"Dress",
"Coat",
"Sandal",
"Shirt",
"Sneaker",
"Bag",
"Ankle boot"
]
model = Sequential()
model.add(Flatten(input_shape=(28,28)))
model.add(Dense(128,activation="relu"))
model.add(Dense(10,activation="softmax"))
model.compile(optimizer="adam",loss="sparse_categorical_crossentropy",metrics=["accuracy"])
model.fit(train_images,train_labels,epochs=20,batch_size=12)
test_loss, test_acc = model.evaluate(test_images,test_labels)
print(f"test accuracy: {test_acc}")
print(f"test loss: {test_loss}")
以下是不会导致BSoD的整个错误消息:
C:\Users\User\AppData\Local\Programs\Python\Python37\python.exe C:/Users/User/PycharmProjects/AI/tutorial.py
2020-01-26 17:53:22.098836: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-01-26 17:53:22.099178: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Using TensorFlow backend.
2020-01-26 17:53:27.826205: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-01-26 17:53:27.826375: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2020-01-26 17:53:27.828951: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-507H6IM
2020-01-26 17:53:27.829139: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-507H6IM
2020-01-26 17:53:27.831554: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Epoch 1/20
12/60000 [..............................] - ETA: 13:55 - loss: 2.5218 - accuracy: 0.1667
600/60000 [..............................] - ETA: 21s - loss: 1.3435 - accuracy: 0.5400
1200/60000 [..............................] - ETA: 13s - loss: 1.1029 - accuracy: 0.6200
1812/60000 [..............................] - ETA: 10s - loss: 0.9730 - accuracy: 0.6634
2424/60000 [>.............................] - ETA: 8s - loss: 0.9054 - accuracy: 0.6852
3048/60000 [>.............................] - ETA: 7s - loss: 0.8507 - accuracy: 0.7008
3636/60000 [>.............................] - ETA: 7s - loss: 0.8226 - accuracy: 0.7109
4200/60000 [=>............................] - ETA: 6s - loss: 0.7984 - accuracy: 0.7176
4836/60000 [=>............................] - ETA: 6s - loss: 0.7760 - accuracy: 0.7235
5460/60000 [=>............................] - ETA: 6s - loss: 0.7497 - accuracy: 0.7313
6060/60000 [==>...........................] - ETA: 5s - loss: 0.7253 - accuracy: 0.7421
6636/60000 [==>...........................] - ETA: 6s - loss: 0.7191 - accuracy: 0.7455
7056/60000 [==>...........................] - ETA: 5:52 - loss: 0.7101 - accuracy: 0.7476
7440/60000 [==>...........................] - ETA: 5:31 - loss: 0.6963 - accuracy: 0.7519
Process finished with exit code -1073741819 (0xC0000005)
这和Tensorflow的构建有什么关系吗?我使用pip
如果我要用巴塞尔建立我自己的Tensorflow,请告诉我怎么做
我正在使用pycharm 2019.3
视窗10
python 3.7
Tensorflow 2.0.0
CPU:AMD Ryzen 5 3600我以前也遇到过类似的问题 您的系统完全能够执行工作负载。(您是否超频了CPU?),这也可能导致不稳定。) 只需卸载tensorflow、python,或者重置pycharm(导出首选项)。 然后重新安装软件包。 这对我来说很有效。 通常这就解决了问题 但我有一个朋友,对他来说这不管用。我们不得不重新设置他的窗口来解决这个问题
希望这有帮助。0xC0000005是访问冲突错误的代码。我想,如果你已经完成了培训过程的一半,也许你已经耗尽了可用的RAM。您有多少可用内存,进程运行时的内存配置文件是什么?@wobr我有16 GB的RAM。我不确定进程的内存配置文件是什么,也许从下面的答案中重新启动会有帮助,但如果没有,建议您在任务管理器运行时只在任务管理器中查看进程内存,以了解您是否正在逐渐提高容量。祝你好运!