adanet icon indicating copy to clipboard operation
adanet copied to clipboard

while running tutorials, TypeError: 'NoneType' object is not iterable

Open yuezhilanyi opened this issue 6 years ago • 8 comments

edit: gpu version, with cuda9.0

Have I written custom code: no
OS Platform and Distribution : win10, x64
TensorFlow installed from (source or binary): pip binary
TensorFlow version (use command below): 1.8  (gpu version)
Cuda version: 9.0
Cudnn: 7.1
Python version: 3.5.2

when i run the two tutorials, it ended with the same issue:

INFO:tensorflow:Saving dict for global step 5000: accuracy = 0.8413, average_loss = 0.46480885, global_step = 5000, loss = 0.46422938

TypeError Traceback (most recent call last) in () 6 eval_spec=tf.estimator.EvalSpec( 7 input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE), ----> 8 steps=None))

TypeError: 'NoneType' object is not iterable

then i tried the solution mentioned in Fix invalid UTF-8 encoding with Python 3 , but it stayed the same.

ps: i intended to try python2, but there was no python2 v1.8 version for win platform.

yuezhilanyi avatar Nov 07 '18 09:11 yuezhilanyi

Could it be that tf.estimator.EvalSpec did not support None steps in TF 1.8?

cweill avatar Nov 07 '18 18:11 cweill

@cweill i changed it to 100 (the default number for tf.estimator.EvalSpec). it stayed almost the same, except print out evaluation progressbar.

before: (steps=None):

INFO:tensorflow:Starting evaluation at 2018-11-07-09:00:11 INFO:tensorflow:Graph was finalized. INFO:tensorflow:Restoring parameters from C:\Users\dell\AppData\Local\Temp\tmp6brw31q8\model.ckpt-5000 INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. INFO:tensorflow:Finished evaluation at 2018-11-07-09:00:14 INFO:tensorflow:Saving dict for global step 5000: accuracy = 0.8413, average_loss = 0.46480888, global_step = 5000, loss = 0.4642294

TypeError Traceback (most recent call last) in () 6 eval_spec=tf.estimator.EvalSpec( 7 input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE), ----> 8 steps=None))

TypeError: 'NoneType' object is not iterable

after: (steps=100):

INFO:tensorflow:Starting evaluation at 2018-11-08-01:13:41 INFO:tensorflow:Graph was finalized. INFO:tensorflow:Restoring parameters from C:\Users\dell\AppData\Local\Temp\tmp1mw6x8zx\model.ckpt-5000 INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. > INFO:tensorflow:Evaluation [10/100] INFO:tensorflow:Evaluation [20/100] ... INFO:tensorflow:Evaluation [90/100] INFO:tensorflow:Evaluation [100/100] INFO:tensorflow:Finished evaluation at 2018-11-08-01:13:43 INFO:tensorflow:Saving dict for global step 5000: accuracy = 0.8421875, average_loss = 0.47057664, global_step = 5000, loss = 0.47057664

TypeError Traceback (most recent call last) in () 6 eval_spec=tf.estimator.EvalSpec( 7 input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE), ----> 8 steps=100))

TypeError: 'NoneType' object is not iterable

yuezhilanyi avatar Nov 08 '18 01:11 yuezhilanyi

@yuezhilanyi: Could you please copy the full log from start to end? It's not clear what is raising this TypeError.

In the meantime you can use Colab to run the tutorials. For examples: https://colab.research.google.com/github/tensorflow/adanet/blob/master/adanet/examples/tutorials/adanet_objective.ipynb

cweill avatar Nov 08 '18 03:11 cweill

@cweill

Here is the full log. full_log.txt

yuezhilanyi avatar Nov 08 '18 06:11 yuezhilanyi

Tensorflow v1.10.0 improved local run behavior in tf.estimator.train_and_evaluate which does not reload checkpoints for evaluation, see release.md.

It maybe the reason that adanet doesn't work well on tf 1.8.0.

yuezhilanyi avatar Nov 12 '18 06:11 yuezhilanyi

Can you try upgrading to TF 1.9+? We recently bumped our minimum version to 1.9.

cweill avatar Nov 12 '18 15:11 cweill

@cweill

Sorry I can't, for it is for production sometimes also.

But I tried on my own laptop with no gpu support and TRAIN_STEPS=1000:

  • when using TF 1.8, the same issues occured;
  • when using TF 1.9, it succeeded

I run the whole adanet_objective.ipynb sucessfully.

yuezhilanyi avatar Nov 13 '18 09:11 yuezhilanyi

Unfortunately, I won't be able to look into TF 1.8 support for a while. If you figure out the source of the issue, feel free to submit a PR.

cweill avatar Nov 13 '18 16:11 cweill