Inferring flags from a config file

I have a config file, config.yaml in which I am defining the various run parameters of model that I want to train. I am defining my guildfile as follows -

- operations:
    train:
      description: 'Training script'
      main: 'train'
      flags-import: no
      requires:
        - config: config/config.yaml

From inside my train.py, I am doing yaml.load(open("train_config.yaml") to get all the param values.
However, when I do guild view, it says that “There are no flags for this run” and all the parameters that I defined in the config file show up as Scalars. I realize that if I define the variables that I want to be considered as flags as flags inside the guild.yml and give them to train.py as command line arguments, the problem will be solved, but I imagined a similar behavior if I define a config file and pass it to guild as a requires/config parameter. Is there any way for guild to consider the values defined under the yaml as flags?

1 Like

Short answer, you need to define the flags in the Guild file. This is a pain I know.

The next release of Guild will have proper flags support for configuration files. This will include the ability to import flags from config files.

I’m guessing your config values are showing up as scalars because you’re printing them to output using the format <name>: <val>. Guild uses this format by default to detect scalars from output.

You can disable this by setting output-scalars to no or by changing the pattern. See Guild File Cheatsheet for examples.

2 Likes

I was applying for an account to post the exact same question.
Would be looking forward to this.

Well done devs for this amazing interface!

Hello and thank you for your input! This is an important new feature and will land in a pre-release soon. You can watch https://my.guild.ai/c/releases/8 for available releases, including pre-releases. Click the bell icon in the upper right and select Watching.

1 Like