maml icon indicating copy to clipboard operation
maml copied to clipboard

itr is referenced before assignment in main.py, line 160

Open rahulbhadani opened this issue 4 years ago • 0 comments

I am executing the omniglot test with the following command:

python main.py --datasource=omniglot --metatrain_iterations=60000 --meta_batch_size=32 --update_batch_size=1 --update_lr=0.4 --num_updates=1 --logdir=logs/omniglot5way/

However, I am getting the error:

Done initializing, starting training.
Traceback (most recent call last):
  File "main.py", line 348, in <module>
    main()
  File "main.py", line 343, in main
    train(model, saver, sess, exp_string, data_generator, resume_itr)
  File "main.py", line 160, in train
    saver.save(sess, FLAGS.logdir + '/' + exp_string +  '/model' + str(itr))
UnboundLocalError: local variable 'itr' referenced before assignment

I inspected the code of main.py and I find that in line 160, saver.save(sess, FLAGS.logdir + '/' + exp_string + '/model' + str(itr)) is being executed outside the for loop but itr variable is a loop iterator variable. Should the save function go inside the for loop?

rahulbhadani avatar Jun 15 '21 17:06 rahulbhadani