Pipeline depending on multiple of the same operation

I have the following setup:

- model: my_model
  operations:
    train: 
      main: scripts.train
      flags:
        a: 1
    evaluate: 
      main: scripts.evaluate
      requires:
          - operation: train
    train_evaluate:
      flags:
        a: 1
      steps:
      - run: train a=${a}
      - run: evaluate
    compare_evaluate:
      main: scripts.compare
      requires:
        - train_evaluate_run_1
        - train_evaluate_run_2
    compare:
      steps:
      - run: train_evaluate a=1
      - run: train_evaluate a=2
      - run: compare_evaluate # HERE
resources:
  train_evaluate_run_1:
    - operation: train_evaluate
      name: train_evaluate_run_1
  train_evaluate_run_2:
    - operation: train_evaluate
      name: train_evaluate_run_2

How to tell guild to resolve two different resources in the compare_evaluate run (with the # HERE tag)?

The goal is to have a script/notebook that takes as input two train_evaluate runs and compares them using custom plotting etc. and have all that specified in a single pipeline.

1 Like

Would you consider creating an addition pipeline to include the two different runs?

op:
  ...

wrapper:
  steps:
    - op [flags 1]
    - op [flags 2]

compare: 
  ...
  requires:
    - operation: wrapper
      select: 
        - file: op/XXX
        - file: op_2/XXX # guild automatically rename operations by adding _[#] 
                         # if there are multiple steps with the same operation

pipeline: 
  steps:
    - wrapper
    - compare

I am not 100% this would work but here’s a direction for you to try.