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.

train.py gives tensorflow ValueError: No variables provided

See original GitHub issue

I try to train the KittiSeg net on my own data, so I have generated Kitti-like groundtruth masks, exported my DATA and RUN directories and created train/val txt files (and put those in KittiSeg.json. When I then run train.py, it starts and initialises the net, but it fails on training with the tensorflow ValueError ‘no variables provided’. That does not sound data-set related or so. Do you know what should I update/provide/change to fix that?

(...)
2017-04-06 15:42:59,665 INFO Creating Summary for: score_pool3/biases
2017-04-06 15:42:59,704 INFO Creating Summary for: upscore32/up_filter
Traceback (most recent call last):
  File "train.py", line 131, in <module>
    tf.app.run()
  File "/home/shah/tensorflow/tensorflow_v1.0.0_py3.5_gpu/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train.py", line 127, in main
    train.do_training(hypes)
  File "incl/tensorvision/train.py", line 377, in do_training
    tv_graph = core.build_training_graph(hypes, queue, modules)
  File "incl/tensorvision/core.py", line 100, in build_training_graph
    global_step, learning_rate)
  File "/home/shah/Coding/KittiSeg/hypes/../optimizer/generic_optimizer.py", line 91, in training
    global_step=global_step)
  File "/home/shah/tensorflow/tensorflow_v1.0.0_py3.5_gpu/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 380, in apply_gradients
    raise ValueError("No variables provided.")
ValueError: No variables provided.

possibly related things:

  • I commented out line 123 (train.maybe_download_and_extract(hypes) in train.py because otherwise it would still download kitti;
  • I got the same commentjson import error as issue #28, so I had to import json instead of commentjson in train.py

Could that last one cause some values to be empty or is it something else?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
dufengtongcommented, Sep 3, 2017

It because the return format of zip() is different between python2 and 3. change the line grads_and_vars = zip(clipped_grads, tvars) in optimizer/generic_optimizer.py to grads_and_vars = list(zip(clipped_grads, tvars)), it works for me.

2reactions
WPSanbergcommented, Apr 10, 2017

It seems to be python-related, I changed from python 3.5 to python 2.7 and the KITTI training works out of the box now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tensorflow 1.14, ValueError: No variables to optimize
But I printed the trainable variables and found that there is no problem with the variables. The version I am using is tensorflow....
Read more >
tf.compat.v1.train.Saver | TensorFlow v2.11.0
The Saver class adds ops to save and restore variables to and from checkpoints. It also provides convenience methods to run these ops....
Read more >
ValueError: No gradients provided for any variable
import tensorflow.keras.callbacks as C checkpoint = C.ModelCheckpoint( ... Changing the monitor gave a better result in this case.
Read more >
No gradients provided for any variable" when training a bijector
You received this message because you are subscribed to the Google Groups "TensorFlow Probability" group. To unsubscribe from this group and ...
Read more >
ValueError: No gradients provided for any variable : r/tensorflow
It basically and usually indicates that the Optimizer can't optimize the gradients. Try training the network using gradient tape or enfore the training ......
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