Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No OpKernel was registered to support Op 'CudnnRNN' used by {{node CudnnRNN}} #361

Open
AkramHB opened this issue Jun 9, 2023 · 2 comments

Comments

@AkramHB
Copy link

AkramHB commented Jun 9, 2023

I’m using tensorflow-cpu 2.10 with tf-directml-plugin, and I did not install cuda toolkit and cudnn (Should I install them? if I should then what versions to install). I keep getting this error

InvalidArgumentError: Graph execution error: No OpKernel was registered to support Op ‘CudnnRNN’ used by {{node CudnnRNN}} with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode=“linear_input”, direction=“unidirectional”, rnn_mode=“lstm”, seed2=0, is_training=true] Registered devices: [CPU, GPU] Registered kernels:

My specs:
Windows 11
RTX 4080

Here is my code:

# Set the maximum vocabulary size
vocab_size = 10000

# Convert the training text to sequences
train_sequences = tokenizer.texts_to_sequences(train_texts)

# Pad the sequences to have the same length
max_sequence_length = max(len(seq) for seq in train_sequences)
train_data = pad_sequences(train_sequences, maxlen=max_sequence_length)

# Create the main model
main_model = Sequential()

# Add the layers to the main model
main_model.add(Embedding(input_dim=vocab_size, output_dim=100, input_length=max_sequence_length))
main_model.add(Bidirectional(LSTM(64, return_sequences=True)))

# Create the Attention layer
attention = Attention()

# Apply the Attention layer to the main model's output
attention_output = attention([main_model.layers[-1].output, main_model.layers[-1].output])

# Create the new model that takes the Attention layer output as input
output = Dense(1, activation='sigmoid')(attention_output)
model = Model(inputs=main_model.input, outputs=output)

# Compile the model
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

# Reshape the predicted labels
train_labels = np.expand_dims(train_labels, axis=-1)

# Train the Bi-LSTM classifier on the whole training dataset
model.fit(train_data, train_labels, epochs=1, batch_size=32, verbose=1)

@PatriceVignola
Copy link
Contributor

You don't need to install cuda toolkit and cudnn as they don't work with this plugin. The plan was to eventually implement the CudnnRNN op for DirectML, but unfortunately we had to pause the development of this plugin until further notice. For the time being, all latest DirectML features and performance improvements are going into onnxruntime for inference scenarios. We'll update this issue if/when things change.

@nickums
Copy link

nickums commented Dec 11, 2024

I have the same problem, but worse having moved from tf 2.10.0 to tf -cpu with plugin.
we need to uninstall the plugin and reinstall ff -gpu==2.10.0
and you will need CUDA 11.2 and CuDNN 8.
only 2 days wasted...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants