Guild in a gitflow workflow

I would like to understand how guild can be integrated into a typical gitflow workflow.

Consider the following example:

  1. I create a feature branch and experiment with a new model using guild.
  2. I find a new BEST_MODEL where all metrics, saved model etc. lives in a guild run
  3. I create a pull request for the code that generated BEST_MODEL

Now the issue is that the current code on my feature branch doesn’t necessarily correspond to the the run that created BEST_MODEL. I am thinking that some kind of guild commit RUN_ID FEAT_BRANCH might be helpful here.

Is there anyway that guild currently support this use case?

Great question. You can run guild diff --working <best run> to see how the best code differs from the current working code base. If you use a diff tool that supports merging, you can selectively merge the changes you want into your code. I use meld for this on Linux.

guild diff --working --cmd meld

This will bring up Meld with the run code on the right and working code on the left. You can then explore what’s changed graphically and merge the changes file by file.

If you’d rather just overwrite everything, you can use a patch method:

guild diff --working --cmd 'diff -u' > best-model.patch

You can look at best-model.patch to see how the run is different from your working code.

To apply the patch, use the reverse option:

patch -R < best-model.patch

Or, more directly:

guild diff --working --cmd 'diff -u' | patch -R

While these steps are arguably a bit painful, they conservatively put the responsibility of updating your code into your hands. I could see an --apply-patch option to the diff command being useful here. But for now you have to manually update your code with the help of Guild’s diff command.

That is really nice and exactly what I was looking for - thank you!

1 Like