Passing arguments, defined in guild.yml file when using Python's argparse

Guild version 0.7.0

I noticed that flags, defined in guild.yml are not passed normally as arguments to config.yml if I use argparse in my Python code. It seems it wants to pass them python arguments even though flags-dest and flags-import are off.

My workflow usually consists of defining main hyperparameters in the config.yml file, but for choosing which gpu to run it on (in my testing phase) I use argparse. Is there a way to combine those two?

In 0.7 flags are independent of support for configuration files. In a future release we’ll promote config files as a proper flags interface. It will also be possible to configure multiple interfaces to direct some flags to one destination and other flags to another. Alas none of this is available yet.

You can sill get this done though. Use the config dependency type: Dependencies.

Here’s an example:

You want to specify args for flag-dest. By default this will pass all flags as command line options. You can disable that for specific flags using arg-skip: yes. You can do this for every arg that you don’t parse with argparse. To skip all flags by default, set default-flag-arg-skip to yes for the operation.

op:
  flags-dest: args
  default-flag-arg-skip: yes
  flags:
    # Add your flag defs used for config.yml
    gpu:
      arg-skip: no
  requires:
    - config: config.yml