rotemtzaban / STIT

MIT License
1.2k stars 170 forks source link

TypeError: Got secondary option for non boolean flag. #8

Closed bdseal closed 2 years ago

bdseal commented 2 years ago

Traceback (most recent call last): File "train.py", line 60, in @click.option('--use_wandb/--no_wandb', default=False) File "/home/anaconda3/lib/python3.7/site-packages/click/decorators.py", line 173, in decorator _param_memo(f, OptionClass(param_decls, **option_attrs)) File "/home/anaconda3/lib/python3.7/site-packages/click/core.py", line 1601, in init raise TypeError('Got secondary option for non boolean flag.') TypeError: Got secondary option for non boolean flag.

Got an error. Anyone knows how to fix this?

rotemtzaban commented 2 years ago

@bdseal What version of click do you have? This similar issue is solved by removing type=bool from the option declaration. Though from the stack trace it seems like you've tried that.

bdseal commented 2 years ago

@rotemtzaban thank you for your prompt response. I have googled and tried that but it didn't work for me. Alternatively, I run the codes using google colab.

rotemtzaban commented 2 years ago

@bdseal Are you simply running the scripts with Google Colab? I haven't tried it but I would expect it to work. Can you check the version of click you have, say with running pip freeze | grep click? Maybe even try to upgrade click to the latest version if possible.

rotemtzaban commented 2 years ago

I can also try later to check the notebook myself, If you want to send me a copy I'll try to look over it

bdseal commented 2 years ago

Sorry for the misunderstanding. The error occured when I tried to run the codes on our lab server. I successfully run the codes on Google Colab.

The version of Click is 7.0, Python 3.7. I have also tried pytorch 1.7 and 1.10, same error.

rotemtzaban commented 2 years ago

@bdseal Oh OK, Thanks for the clarification, glad to know it works well on Colab. I've reproduced the issue on my server with click==7.0, and it seems to be fixed by removing all the type=bool from flag options. e.g. make sure to remove it from the use_dlib and use_locality_reg flags as well. Alternatively, upgrading click to 7.1 or higher also seems to work for me

bdseal commented 2 years ago

Thanks. Considering that #7 is also caused by the package version, it might be helpful to add a requirements.txt.

Besides, this is a simple Colab notebook I used. Maybe it would be helpful for those who want to try STIS on Colab like me before you released the official one.