pytorch-ZSSR icon indicating copy to clipboard operation
pytorch-ZSSR copied to clipboard

A small fix for the <config> arguments in Python3

Open ZFhuang opened this issue 3 years ago • 0 comments

Thanks for the Pytorch implement of ZSSR, it helps me a lot! 👍

Although this project is written in Python2, it still works well for me in Python3. However, when using the <config> arguments, it will not work. Because the exec() is a function not a statement now thus the conf in run_ZSSR_single_input.py can't be updated as expected.

For anyone who wants to use this project in Python3, you could fix this problem by a small change in run_ZSSR_single_input.py.

from:

    # Setup configuration and results directory
    conf = configs.Config()
    if conf_str is not None:
        exec ('conf = configs.%s' % conf_str, dic)
    conf.result_path = results_path

to:

    # Setup configuration and results directory
    conf = configs.Config()
    if conf_str is not None:
        dic={"conf":conf, "configs":configs}
        exec ('conf = configs.%s' % conf_str, dic)
        conf=dic["conf"]
    conf.result_path = results_path

ZFhuang avatar Apr 15 '21 15:04 ZFhuang