- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我通过关注 this tutorial 迈出了深度学习的第一步,一切都很顺利,直到我需要在 Jupyter Notebook 中训练网络。我几乎尝试了所有方法,但总是收到此错误
The kernel appears to have died. It will restart automatically.
当我检查终端时我可以看到这个
[I 18:32:24.897 NotebookApp] Adapting to protocol v5.1 for kernel 0d2f57af-46f5-419c-8c8e-9676c14dd9e3
2019-03-09 18:33:12.906756: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-03-09 18:33:12.907661: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance.
OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
[I 18:33:13.864 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 0d2f57af-46f5-419c-8c8e-9676c14dd9e3 restarted
我尝试运行的代码相当简单(即使对于刚刚开始深度学习的我来说也是如此)
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train = tf.keras.utils.normalize(x_train, axis=1)
x_test = tf.keras.utils.normalize(x_test, axis=1)
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu))
model.add(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=3)
val_loss, val_acc = model.evaluate(x_test, y_test)
print(val_loss)
print(val_acc)
我尝试了所有的想法,并在 Google 上遇到了几乎所有相同的问题。
最佳答案
您下载的是哪个版本的tensorflow?
从错误日志看来,存在一些 OpenMP 库问题,我会尝试将 Tensorflow 重新安装到最新的稳定版本。
我必须更新我的 tensorflow (1.13.1)安装才能使该代码正常工作,这是我的输出。
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Epoch 1/3
60000/60000 [==============================] - 6s 94us/sample - loss: 0.2652 - acc: 0.9213
Epoch 2/3
60000/60000 [==============================] - 6s 95us/sample - loss: 0.1103 - acc: 0.9660
Epoch 3/3
60000/60000 [==============================] - 6s 100us/sample - loss: 0.0735 - acc: 0.9765
10000/10000 [==============================] - 0s 35us/sample - loss: 0.0875 - acc: 0.9731
0.08748154099322855
0.9731
根据您使用的库管理器,尝试升级
对于 Pip 和 Python3:
pip3 install tensorflow --upgrade
对于 python :
conda update tensorflow
然后运行
import tensorflow as tf
print(tf.__version__)
验证您是否拥有最新的可用版本
关于python - 当我运行代码时,jupyter笔记本的内核不断死亡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55083432/
我使用适用于 Windows 的 QuickBooks。并且 Windows 应用程序调用我的后端,在某些库脚本中它调用 exit 或 die ...所以我无法捕获响应,需要检测退出运行的位置或在退出
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 4年前关闭。 Improve thi
我很无聊,只有 30 分钟的空闲时间,所以我决定尝试一下制作生活游戏。我在维基百科上遵循了该规则,但它似乎无法正常工作。有人可以告诉我我会做错什么吗? 规则如下: 任何少于两个活邻居的活细胞都会死亡,
我的社交网络上有一个简单的插入查询,允许用户在文本区域中输入文本并将其输出到他们的个人资料页面上。他们可以选择删除,并按预期将状态标记为“死亡”,并删除更新。问题是,如果他们只是输入一个新的内容,而不
这可能是一个硬件问题,因为我不确定后台 worker 是如何实现的,但问题是:我有 3 个后台 worker 运行不同的线程。我对这些线程进行了编码,以便在它们开始和结束时显示,但我得到了一些非常奇怪
我有一个简单的服务器: from multiprocessing import Pool, TimeoutError import time import os if __name__ == '__m
在这里,我尝试在线程终止后加入该线程,代码工作正常,但我的问题是它不应该抛出一些错误消息或任何信息吗? public class MultiThreadJoinTest implements Runn
我正在开发一个简单的 Android 项目,但遇到了可怕的致命异常,并且确实不知道如何确定我是否在 Android 世界中做一些越界的事情...... 我有这个代码: private OnClickL
我正在尝试编写一个程序,根据用户输入值“n”,我将 fork 那么多进程以同时运行。此外,每个 child 都试图执行我创建的另一个文件,这将生成 x sleep 时间和 x 退出值。最终,当 chi
我们知道,当系统资源耗尽时,后台 Activity 会序列化其状态并被操作系统杀死。当我们恢复它时,操作系统通过传递给 onCreate 方法的 savedInstanceState 恢复 Activ
我想这样做是为了测试我的代码。我想我可以围绕弱引用对象制作另一个包装器,但更愿意直接工作以模拟原始对象被回收。 这是我目前的代码 var myString = "someString"; var
我使用 GCM 在发布图片时收到通知,然后我下载并处理它: public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
我有一个带有中央事件机制的程序,该机制使用 select、epoll 或 kevent(平台依赖、OSX、Linux 和 FreeBSD)。 现在我有一个问题,我需要等待一个进程完成执行。我从这个过程
我有一个非常简单的函数,如下所示: public static boolean isAppInstalled(String packageName) { PackageManager pm =
我有一个接受图像复制/粘贴的 TinyMCE 表单。输入完评论后,按“发布”,它会提交表单,解析内容并显示在屏幕对话中。 我正在尝试使用 preg_match_all 从 POSTed 变量中提取 b
这是我在 vs 代码中的交互式窗口中运行代码时显示的错误消息: C:\Users\rohit\AppData\Roaming\Python\Python38\site-packages\traitle
在 Scala 中,当另一个(远程)actor 终止时,可以通过设置 trapExit 标志并使用第二个 actor 作为参数调用 link() 方法来通知一个 actor。在这种情况下,当远程参与者
我正在tpot上运行dask在gcp的kubernetes集群上运行,该集群是24核120 GB内存,带有4个kubernetes节点,我的kubernetes yaml是 apiVersion: v
几周来我一直在为这个问题苦苦挣扎。我对 Android 还很陌生,希望您能帮助我。 我有这个服务,它运行在与应用程序不同的线程上。本质上,用户指示它启动,并且它应该保持 Activity 状态,直到用
我正在编写一个插件,它从不和谐中获取消息并将其发送到我的世界服务器。Minecraft 客户端很难渲染表情符号。因此我选择使用https://github.com/kcthota/emoji4j将所有
我是一名优秀的程序员,十分优秀!