cc-ai / climategan

Code and pre-trained model for the algorithm generating visualisations of 3 climate change related events: floods, wildfires and smog.
https://thisclimatedoesnotexist.com
GNU General Public License v3.0
72 stars 18 forks source link

Bug in the optim.py #145

Closed tianyu-z closed 3 years ago

tianyu-z commented 3 years ago

After updating to the latest master, I got this:

Traceback (most recent call last):
  File "train.py", line 199, in <module>
    main()
  File "/home/mila/t/tianyu.zhang/myenv/lib/python3.7/site-packages/hydra/main.py", line 24, in decorated_main
    strict=strict,
  File "/home/mila/t/tianyu.zhang/myenv/lib/python3.7/site-packages/hydra/_internal/utils.py", line 174, in run_hydra
    overrides=args.overrides,
  File "/home/mila/t/tianyu.zhang/myenv/lib/python3.7/site-packages/hydra/_internal/hydra.py", line 86, in run
    job_subdir_key=None,
  File "/home/mila/t/tianyu.zhang/myenv/lib/python3.7/site-packages/hydra/plugins/common/utils.py", line 109, in run_job
    ret.return_value = task_function(task_cfg)
  File "train.py", line 175, in main
    trainer.setup()
  File "/home/mila/t/tianyu.zhang/omnigan/omnigan/trainer.py", line 252, in setup
    self.G, self.opts.gen.opt, self.opts.tasks
  File "/home/mila/t/tianyu.zhang/omnigan/omnigan/optim.py", line 72, in get_optimizer
    elif len(opt_conf.lr) == 1:  # Use default for all tasks
TypeError: object of type 'float' has no len()

I get back to opts.gen.opt.lr in defaults.yaml and I find it is indeed a float: 0.00001 I suggest we check the type of opt_conf.lr before len(opt_conf.lr) or we change the defaults.yaml. image