我正试图通过使用cuDNN内核来训练LSTM生成模型以加快过程,但我的模型似乎不符合标准。我很难理解到底是什么问题。
以下是警告:
WARNING:tensorflow:Layer lstm will not use cuDNN kernel since it doesn't meet the cuDNN kernel criteria. It will use generic GPU kernel as fallback when running on GPU
这是我的生成模型:
def build_generative_model(vocab_size, embed_dim, lstm_units, lstm_layers, batch_size, dropout=0):
model = tf.keras.Sequential()
model.add(tf.keras.layers.Embedding(vocab_size, embed_dim, batch_input_shape=[batch_size, None]))
for i in range(max(1, lstm_layers)):
model.add(tf.keras.layers.LSTM(lstm_units, return_sequences=True, stateful=True, dropout=dropout, recurrent_dropout=dropout))
model.add(tf.keras.layers.Dense(vocab_size))
return model
我把它修好了,我觉得很愚蠢哈哈哈。对于任何有此问题的人,请查看以下要求:https://www.tensorflow.org/api_docs/python/tf/keras/layers/LSTM慢慢地浏览每一个,并将层设置为适当的值,在我的情况下是
recurrent_dropout = 0
而不是
recurrent_dropout = 0.0