| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
r"""Example of basic DEFINE_flag_dict usage. |
| 17 |
|
| 18 |
To run this example with basic config file: |
| 19 |
python define_config_dict_basic.py -- \ |
| 20 |
--my_config=ml_collections/config_flags/examples/config.py |
| 21 |
\ |
| 22 |
--my_config.field1=8 --my_config.nested.field=2.1 \ |
| 23 |
--my_config.tuple='(1, 2, (1, 2))' |
| 24 |
|
| 25 |
To run this example with parameterised config file: |
| 26 |
python define_config_dict_basic.py -- \ |
| 27 |
--my_config=ml_collections/config_flags/examples/parameterised_config.py:linear |
| 28 |
\ |
| 29 |
--my_config.model_config.output_size=256' |
| 30 |
""" |
| 31 |
|
| 32 |
|
| 33 |
from absl import app |
| 34 |
|
| 35 |
from ml_collections import config_flags |
| 36 |
|
| 37 |
_CONFIG = config_flags.DEFINE_config_file('my_config') |
| 38 |
|
| 39 |
|
| 40 |
def main(_): |
| 41 |
print(_CONFIG.value) |
| 42 |
|
| 43 |
|
| 44 |
if __name__ == '__main__': |
| 45 |
app.run(main) |