我在用角星训练我的模特。当我比较GPU和CPU的性能时。CPU版本比GPU版本快得多。
我如何修正下面的这些错误?
我试图强迫tensorflow到GPU,我得到了以下错误:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device to node 'gradients/simple_rnn_1/while/Select_1_grad/Select/f_acc':
Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
Colocation Debug Info:
Colocation group had the following types and devices:
Tile: CPU
StackPush: GPU CPU
Relu: GPU CPU
ReluGrad: GPU CPU
ZerosLike: GPU CPU
Select: GPU CPU
StackPop: GPU CPU
AddN: GPU CPU
RefEnter: GPU CPU
Stack: GPU CPU我的模特看起来是这样的:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
masking_1 (Masking) (None, None, 3) 0
_________________________________________________________________
simple_rnn_1 (SimpleRNN) (None, None, 50) 2700
_________________________________________________________________
time_distributed_1 (TimeDist (None, None, 11) 561
_________________________________________________________________
activation_1 (Activation) (None, None, 11) 0
=================================================================
Total params: 3,261
Trainable params: 3,261 编辑:当我将后端切换到theano时,相同的网络在GPU上运行得更快,我认为在tensorflow中GPU上的“瓷砖”有一个问题。
发布于 2022-08-07 12:47:51
如果您正在使用ReLU,请尝试使用Tanh丢失。
我在100个年代用ReLU建立了一个LSTM模型.每一个时代从14秒到2秒。
希望这能解决你的问题--我也是在GPU上运行的,所以很不幸,它可能只是你的处理器--如果你遇到瓶颈,可以使用google Colab --你可以使用免费的GPU。
https://stackoverflow.com/questions/43758143
复制相似问题