AttributeError due to a lack of default value in phi3-qa.py
romanows opened this issue · comments
When running this script, there's an error message AttributeError: 'Namespace' object has no attribute 'do_random_sampling'
. This is because in this line there is no default=False
argument.
It's confusing, but the reason default=False
is needed here is because the parser was created with the argument_default=argparse.SUPPRESS
argument. I hadn't come across that before and was questioning my sanity as to why action='store_true'
wasn't sufficient to cause the argument to appear in the namespace of args
!
I think this PR might address the error you're seeing: #531
Could you retry with the script from main now?
That looks like it'll work to me, thanks! I don't know if any docs have to be updated since you changed the name of the argument (if you're concerned about that, I believe you can specify multiple long names and argparse will assign the value to the first one it encounters. So something like parser.add_argument('-ds', '--do_sample', '--do_random_sampling', action='store_true', default=False, ...
should be backwards-compatible.)