question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in Train.py: I've been trying to figure it out for an hour now

See original GitHub issue

So everything runs fine until the line: batch_loss, batch_acc = model.train_on_batch([title_batch, past_batch], [pred_batch])

I figured it was a syntax error or something so I did some research. Although I’ve didn’t see it used this way, there was nothing wrong with the syntax. So I updated all of my Libraries and tried it again. Still the same error. No matter what I did, I couldn’t get it to work. If anyone cares, or is even out there (this is not a maintained repository so maybe I’m alone), your help would be immensely appreciated.

Here’s the full error log. pls help me

Traceback (most recent call last): File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1322, in _do_call return fn(*args) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1305, in _run_fn self._extend_graph() File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1340, in _extend_graph tf_session.ExtendSession(self._session) tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op ‘CudnnRNN’ with these attrs. Registered devices: [CPU], Registered kernels: <no registered kernels>

[[Node: cu_dnngru_1/CudnnRNN = CudnnRNN[T=DT_FLOAT, direction=“unidirectional”, dropout=0, input_mode=“linear_input”, is_training=true, rnn_mode=“gru”, seed=87654321, seed2=0](cu_dnngru_1/transpose, cu_dnngru_1/ExpandDims_1, cu_dnngru_1/Const_1, cu_dnngru_1/concat)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “C:/Users/(Censored)/PycharmProjects/YouTubeCommenter/Train.py”, line 170, in <module> batch_loss, batch_acc = model.train_on_batch([title_batch, past_batch], [pred_batch]) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py”, line 1449, in train_on_batch outputs = self.train_function(ins) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py”, line 2947, in call if hasattr(get_session(), ‘_make_callable_from_options’): File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py”, line 204, in get_session [tf.is_variable_initialized(v) for v in candidate_vars]) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 900, in run run_metadata_ptr) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1135, in _run feed_dict_tensor, options, run_metadata) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1316, in _do_run run_metadata) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py”, line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op ‘CudnnRNN’ with these attrs. Registered devices: [CPU], Registered kernels: <no registered kernels>

[[Node: cu_dnngru_1/CudnnRNN = CudnnRNN[T=DT_FLOAT, direction=“unidirectional”, dropout=0, input_mode=“linear_input”, is_training=true, rnn_mode=“gru”, seed=87654321, seed2=0](cu_dnngru_1/transpose, cu_dnngru_1/ExpandDims_1, cu_dnngru_1/Const_1, cu_dnngru_1/concat)]]

Caused by op ‘cu_dnngru_1/CudnnRNN’, defined at: File “C:/Users/(Censored)/PycharmProjects/YouTubeCommenter/Train.py”, line 94, in <module> x = CuDNNGRU(200, return_sequences=USE_OUT_SEQ)(x) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\layers\recurrent.py”, line 533, in call return super(RNN, self).call(inputs, **kwargs) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\base_layer.py”, line 450, in call output = self.call(inputs, **kwargs) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\layers\cudnn_recurrent.py”, line 90, in call output, states = self._process_batch(inputs, initial_state) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\layers\cudnn_recurrent.py”, line 297, in _process_batch is_training=True) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\contrib\cudnn_rnn\python\ops\cudnn_rnn_ops.py”, line 1621, in call seed=self._seed) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\contrib\cudnn_rnn\python\ops\cudnn_rnn_ops.py”, line 1010, in _cudnn_rnn_no_input_c direction, dropout, seed, name) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\contrib\cudnn_rnn\python\ops\cudnn_rnn_ops.py”, line 922, in _cudnn_rnn outputs, output_h, output_c, _ = gen_cudnn_rnn_ops.cudnn_rnn(**args) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_cudnn_rnn_ops.py”, line 143, in cudnn_rnn is_training=is_training, name=name) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py”, line 787, in _apply_op_helper op_def=op_def) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py”, line 3414, in create_op op_def=op_def) File “C:\Users(Censored)\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py”, line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op ‘CudnnRNN’ with these attrs. Registered devices: [CPU], Registered kernels: <no registered kernels>

[[Node: cu_dnngru_1/CudnnRNN = CudnnRNN[T=DT_FLOAT, direction=“unidirectional”, dropout=0, input_mode=“linear_input”, is_training=true, rnn_mode=“gru”, seed=87654321, seed2=0](cu_dnngru_1/transpose, cu_dnngru_1/ExpandDims_1, cu_dnngru_1/Const_1, cu_dnngru_1/concat)]]

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
HackerPoetcommented, May 6, 2019

Installing CUDA and cuDNN is best because it will train significantly faster. But if you can’t get it working, just replace the instance of ‘CuDNNGRU’ with ‘GRU’.

0reactions
Ajeet-Yadavcommented, Mar 31, 2020

Make sure you have Nvidia graphics card as CUDA & cuDNN are Nvidia’s library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on running train.py #24 - GitHub
Hello, I've been trying to get the training script to run but have been running into some issues. The current issue I'm facing...
Read more >
Unknown error when running train.py or model_main.py
I've tried both train.py and model_main.py as I'm running on tensorflow-gpu 1.8 through anaconda. in the training folder labelmap.pbtxt does ...
Read more >
Custom Model training error - Colab - DeepStack Forum
I've been trying for 3 days straight and no luck. unfortunately my non-GPU training seems to get disconnected after about 12 hours.
Read more >
OpenNMT-py error when training with large amount of data
Hi,. The error message indicates that one or more of your lines are missing either the token or the frequency. It should be...
Read more >
11 Beginner Tips for Learning Python Programming
Watch Now This tutorial has a related video course created by the Real Python team. ... If you hit a bug and can't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found