Skip to content

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

@rahulbhadani

Description

@rahulbhadani

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions