我正在运行Keras模型,提交截止日期为36小时,如果我在cpu上训练我的模型需要大约50个小时,有没有办法在gpu上运行Keras?
我正在使用Tensorflow后端并在我的Jupyter笔记本上运行它,没有安装anaconda.
当我运行keras脚本时,我得到以下输出:
Using TensorFlow backend.
2017-06-14 17:40:44.621761: W
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow
library wasn't compiled to use SSE4.1 instructions, but these are
available on your machine and could speed up CPU computations.
2017-06-14 17:40:44.621783: W
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow
library wasn't compiled to use SSE4.2 instructions, but these are
available on your machine and could speed up CPU computations.
2017-06-14 17:40:44.621788: W
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow
library wasn't compiled to use AVX instructions, but these are
available on your machine and could speed up …Run Code Online (Sandbox Code Playgroud) 我知道在安装tensorflow时,您要么安装GPU版本,要么安装CPU版本.如何检查安装了哪一个(我使用的是linux).
如果安装了GPU版本,如果GPU不可用,它会自动在CPU上运行还是会抛出错误?如果GPU可用,是否需要设置特定字段或值以确保它在GPU上运行?
我在 Windows 10 上运行带有 keras-gpu 和 tensorflow-gpu 的 CNN,带有 NVIDIA GeForce RTX 2080 Ti。我的电脑有一个 Intel Xeon e5-2683 v4 CPU (2.1 GHz)。我正在通过 Jupyter(最新的 Anaconda 发行版)运行我的代码。命令终端中的输出显示 GPU 正在被使用,但是我正在运行的脚本花费的时间比我预期的训练/测试数据要长,而且当我打开任务管理器时,GPU 利用率似乎非常低。这是一张图片:
请注意,CPU 没有被利用,任务管理器上的任何其他内容都没有表明任何东西都被充分利用了。我没有以太网连接并且已连接到 Wifi(不认为这会产生任何影响,但我不确定 Jupyter,因为它通过网络浏览器运行)。我正在训练大量数据 (~128GB),这些数据都加载到 RAM (512GB) 中。我正在运行的模型是一个全卷积神经网络(基本上是一个 U-Net 架构),具有 566,290 个可训练参数。到目前为止我尝试过的事情: 1. 将批大小从 20 增加到 10,000(将 GPU 使用率从 ~3-4% 增加到 ~6-7%,按预期大大减少训练时间)。2. 将 use_multiprocessing 设置为 True 并增加 model.fit 中的工作人员数量(无效)。
我按照这个网站上的安装步骤操作:https : //www.pugetsystems.com/labs/hpc/The-Best-Way-to-Install-TensorFlow-with-GPU-Support-on-Windows-10-Without-Installing -CUDA-1187/#look-at-the-job-run-with-tensorboard
请注意,此安装不会专门安装 CuDNN 或 CUDA。过去我在使用 CUDA 运行 tensorflow-gpu 时遇到了麻烦(虽然我已经超过 2 年没有尝试过,所以使用最新版本可能更容易),这就是我使用这种安装方法的原因。
这很可能是 GPU 没有得到充分利用的原因(没有 CuDNN/CUDA)吗?是否与专用 GPU …
我已经成功安装了 tensorflowpip install tensorflow并且一切都按预期工作。
我也可以成功安装 tensorflow-gpupip install tensorflow-gpu但我无法在我的 python 脚本中导入它:
import tensorflow-gpu
File "<stdin>", line 1
import tensorflow-gpu
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我已经安装了 CUDA v9.0 并运行了 Windows 10
我在 Paperspace 云基础架构上创建了虚拟笔记本,后端使用 Tensorflow GPU P5000 虚拟实例。当我开始训练我的网络时,它比使用纯 CPU 运行时引擎的 MacBook Pro 慢 2 倍。我如何确保 Keras NN 在训练过程中使用 GPU 而不是 CPU?
请在下面找到我的代码:
from tensorflow.contrib.keras.api.keras.models import Sequential
from tensorflow.contrib.keras.api.keras.layers import Dense
from tensorflow.contrib.keras.api.keras.layers import Dropout
from tensorflow.contrib.keras.api.keras import utils as np_utils
import numpy as np
import pandas as pd
# Read data
pddata= pd.read_csv('data/data.csv', delimiter=';')
# Helper function (prepare & test data)
def split_to_train_test (data):
trainLenght = len(data) - len(data)//10
trainData = data.loc[:trainLenght].sample(frac=1).reset_index(drop=True)
testData = data.loc[trainLenght+1:].sample(frac=1).reset_index(drop=True)
trainLabels = trainData.loc[:,"Label"].as_matrix()
testLabels = testData.loc[:,"Label"].as_matrix() …Run Code Online (Sandbox Code Playgroud) 我想在我的Windows 7 64位计算机上安装Tensorslow.
我用Python 3.5安装了Anaconda.
之后我做了
conda install theano
它成功完成了.
conda install mingw libpython
成功完成了.
pip install tensorflow
错误
我无法以与安装这些其他软件包相同的方式安装Tensorflow.我错过了什么基本的东西?
tensorflow ×7
keras ×5
python ×4
gpu ×2
anaconda ×1
conda ×1
jupyter ×1
python-3.x ×1
windows ×1