- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 PyCharm,我是 python 的新手。
经过 2 天弄清楚 tensorflow 的工作原理后,我成功了,但启动时间很慢。在句子之前一切正常:'Adding visible gpu device : 0' 这需要 7/8 分钟。
我搜索并尝试了 export CUDA_CACHE_MAXSIZE 和 CUDA_FORCE_PTX_JIT=1 之类的东西,但它不起作用,我是 python 的初学者,特别是在 tensorflow 中,所以我正在寻找一个非常清晰的解决方案,如果解决方案存在的话。
因此,如果有人有解决方案,请告诉我,我将不胜感激。
祝你今天愉快,对不起我的英语。
系统信息:
Windows 10 x64、Gtx 1060、i5、16Go 内存
Python 3.8.7
Cuda v10.1
tensorflow 2.2.0
cuDNN 7.6
编辑:我正在向 YouTube 上的“freecodchamp”学习,所以我遵循了一些开始的代码
这是我的源代码:
import tensorflow as tf
import numpy
import tensorflow_datasets
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
tensor1 = tf.ones([2, 3]) # shape 2x3
print('shape tensor 1 = ', tf.shape(tensor1)) # Doing some test for learning
tensor2 = tf.reshape(tensor1, [1, 2, 3])
print('shape tensor 2 = ', tf.shape(tensor2))
tensor1 = tf.reshape(tensor1, [1, 1, 1, 1, 1, 6])
print('shape tensor 1 reshaped = ', tf.shape(tensor1))
输出:
2021-01-04 10:04:31.355144: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-04 10:04:43.401510: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-01-04 10:04:43.498316: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 3.00GiB deviceMemoryBandwidth: 178.99GiB/s
2021-01-04 10:04:43.499195: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-04 10:04:43.548183: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-01-04 10:04:43.583967: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-01-04 10:04:43.595863: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-01-04 10:04:43.637187: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-01-04 10:04:43.668089: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-01-04 10:04:43.773909: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-01-04 10:04:43.774488: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-01-04 10:04:43.779002: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-01-04 10:04:43.820840: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x16676079d90 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-01-04 10:04:43.821794: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2021-01-04 10:04:43.824342: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 3.00GiB deviceMemoryBandwidth: 178.99GiB/s
2021-01-04 10:04:43.825340: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-01-04 10:04:43.825837: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-01-04 10:04:43.826331: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-01-04 10:04:43.826816: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-01-04 10:04:43.827303: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-01-04 10:04:43.827801: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-01-04 10:04:43.828297: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-01-04 10:04:43.828914: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-01-04 10:16:39.045025: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-01-04 10:16:39.045537: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
2021-01-04 10:16:39.045836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
2021-01-04 10:16:39.047684: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2095 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
2021-01-04 10:16:39.056201: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1661e481430 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2021-01-04 10:16:39.056798: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1060, Compute Capability 6.1
shape tensor 1 = tf.Tensor([2 3], shape=(2,), dtype=int32)
shape tensor 2 = tf.Tensor([1 2 3], shape=(3,), dtype=int32)
shape tensor 1 reshaped = tf.Tensor([1 1 1 1 1 6], shape=(6,), dtype=int32)
Process finished with exit code 0
正如您在“Adding visible gpu devices :0”行和下一行之间看到的那样,它花了 12 分钟一切都运行正常,我只是想运行得更快,因为我不想每次运行这个程序都需要那么长时间。
最佳答案
用win10和tensorflow==2.3有同样的错误。可以通过切换到 tensorflow==2.4 来修复
或者,您也可以切换到 Linux。我感觉 tensorflow 对它的支持(和测试)要好得多。
关于python - tensorflow : slow startup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65554962/
我试图在 GCE 上启动时让以下脚本在 CentOS 实例上运行。 我在实例名称上设置了自定义元数据“启动脚本”,并将以下脚本作为值。 该脚本不会在启动、重启或运行/usr/share/google/
我在我的一个类中添加了一个 startUp-Method,它立即退出了我的图像。有没有办法阻止 Photo 执行该方法以便我可以修复它? 最佳答案 不,这是一个持续讨论的问题。见 this post在
我在启动类中收到“'Startup.Configuration' 和'Startup.Configuration' 之间的歧义”错误。我不知道我做了什么导致这个问题。我所做的只是创建了一个 DBCon
asp.net 5 中的 Startup 类让我觉得很奇怪。它不是类 Startup : ISomething 或 Startup : BaseSomething ,其中接口(interface)或基
我有这个代码: https://github.com/nbarbettini/SimpleTokenProvider/tree/master/test/SimpleTokenProvider.Test
这个问题在这里已经有了答案: What does the servlet value signify (11 个答案) 关闭 7 年前。 考虑到同样的问题,我是 J2EE 的新手,请回答。当我们使
关闭。这个问题是opinion-based .它目前不接受答案。 想改进这个问题?更新问题,以便 editing this post 提供事实和引用来回答它. 8年前关闭。 Improve this
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
如何以编程方式查找在设备启动时启动的应用程序列表。有什么方法可以以编程方式禁用您不需要的自动启动应用程序。 谢谢 最佳答案 除了删除有问题的应用程序之外,别无他法。 API 表示系统必须接受对 BOO
我知道它们用于调用 main(),但如果那是唯一目的,那么拥有不同的 crt 文件有什么意义。为什么不使用默认的而不是创建自己的? 最佳答案 CRT 文件是 C 运行时文件。您最有可能遇到的是 crt
我正在运行一个带有在重启时调用的启动脚本的 EC2 实例。此启动脚本在启动容器之前检查 docker 守护进程是否正在运行,但失败并显示错误:Post http:///var/run/docker.s
我有一个项目,其中包含许多具有自己的日志记录的“工具”类。这些日志文件是在应用程序启动时创建的,但在使用之前一直为空。 是否可以告诉logback在启动时不应该创建空文件?但是仅在使用它们时? 不知何
我正在尝试创建自己的自定义钻取功能,其中 URL dynamics://0?myfunction_123456 将启动我自己的代码。 在 C\SysStartupCmd\construct 中,这个基
我有一个 RFID 模块连接到我的 beaglebone 并使用 python 代码读取 ID 标签。现在,我希望我的 python 代码在没有任何命令的情况下登录我的 beaglebone 时直接在
我试图探索一些 ASP.NET-5 应用程序,我在其中找到了 startup.cs 文件。我们在这里设置路由和所有(当然不仅仅针对路由)。我还看到一些演示,其中显示了依赖注入(inject)的使用 h
我遇到以下问题。我有一个带有 UI、nib 等的 Cocoa 应用程序。我需要能够在后台或前台启动该应用程序。换句话说,我需要前者中的 NSApplicationActivationPolicyPro
我在 Windows 上,根据 this startup.el 用于emacs 的启动。但是当我在这个文件中设置代码时(C:\Users\frountch\Progs\emacs24\share\em
asp.net mvc 6 beta5 我尝试使用 config.json 来激活\禁用日志记录 public IConfiguration Configuration { get; set; } p
我一直在查看 ASP.NET Web API 默认项目,它带有 ASP.NET Identity 身份验证,它使用 Owin。我在谷歌上搜索了一下,发现 Owin 旨在将应用程序与服务器分离,并且它的
我是一名优秀的程序员,十分优秀!