yzhangcs / parser

:rocket: State-of-the-art parsers for natural language.
https://parser.yzhang.site/
MIT License
827 stars 139 forks source link

params from config.ini overridden by defaults #68

Closed attardi closed 3 years ago

attardi commented 3 years ago

I have a config.ini file that contains:

[Data]
encoder = 'bert'

but when calling the parser with -c=config.ini, it gets overwritten by the default value 'lstm'. I would expect that values provided through config.ini would replace the defaults, or else I don't see the point of providing a config file.

yzhangcs commented 3 years ago

@attardi Sorry there may be some confusion. You still have to provide some values on command-line. The priority is: argparse > config.ini > others. config.ini provides many default hyperparams for training, which are usually not changed. argparse gives you more flexible choices. You can specify some params on command-line not registered in argparse but stored in config file.

attardi commented 3 years ago

Then why do you specify

[Data]
encoder = 'bert'

in ud.biaffine.dep.xlmr.ini?

What's the point if it is ignored?

yzhangcs commented 3 years ago

Because I forgot to delete them from argparse 😓 .

attardi commented 3 years ago

There are three types of defaults:

  1. command line
  2. config
  3. function parameter defaults

To me this would be the most sensible priority order.

yzhangcs commented 3 years ago

Indeed many args in config are useless, just suggestions for appropriate ones.

attardi commented 3 years ago

The logic of a config file is to collect in one place all parameters needed in an experiment. They should override the defaults. You may then individually override some of them on the command line, as a last minute minor variation. In your interpretation, you might just as well get rid of the config file, since it is useless.

attardi commented 3 years ago

The priority is: argparse > config.ini > others.

The argparse is always present with a default value, which might be overwritten in the command line, hence config.ini is useless.

yzhangcs commented 3 years ago

@attardi Yeah, but I think it's trivial to register many params like lr, epochs in argparse.