Shared flags for a subset of operations

train_model:
  main: train
  flags:
    lr: 1e-3
    bs: 256
    ...
    optim: 'adam'

train_model_but_small_difference:
  main: train
  flags:
    lr: 1e-3
    bs: 256
    ...
    optim: 'SGD'

Following Issue:
Let’s assume I have some different operations for which most of the flags are exactly the same, e.g. I want to have similar model structure etc. but just have different loss functions (and maybe 2 or three other flags such that we need different operations). Is there a possiblity to have shared flags for this subset of models? → shared flags for lr, bs etc. such that I have to only change it once and see the effect on multiple operations

Use includes, like this:

- config: shared-attrs
  flags:
    foo: 123
    bar: abc

- operations:
    train-1:
      flags:
        $include: shared-attrs
    train-2:
      flags:
        $include: shared-attrs
        bam: xyz

Note that this uses Guild’s full format for guild.yml. The structure becomes a list (rather than “operation only” which is a dict/map). A config section is just a place to hold config that other parts of the file can reference. It doesn’t impact your model defs. The second section has an implicit model: '' attr, which is the anonymous model. This is what you get with “operation only” format, implicitly.

1 Like