tango icon indicating copy to clipboard operation
tango copied to clipboard

Does tango provide a way to compose config files

Open BigRedT opened this issue 2 years ago • 3 comments

Config files for machine learning projects can often get quite long (data paths, model config, training hyper-parameters). In past projects, I have used frameworks like Hydra to compose smaller config files. This also allows swapping out individual components. Does Tango provide a way to compose config files?

BigRedT avatar Aug 25 '22 17:08 BigRedT

I'm not familiar with Hydra but that looks interesting.

JSONNET does allow sourcing from other JSONNET files. So I often make a common.jsonnet file where I put step definitions and hyperparameaters that I use in other configs, and source those into the other configs. Does that solve your use case?

epwalsh avatar Aug 25 '22 17:08 epwalsh

Could you share an example of how that works in jsonnet? Also, is there something similar for yaml? I prefer yaml slightly because it has less syntax/brackets etc cluttering the file :)

BigRedT avatar Aug 25 '22 21:08 BigRedT

I do like YAML syntax better as well, but tend to use JSONNET because of all its features.

So for example, create a file common.jsonnet:

{ hyperparams: { learning_rate: 0.01 } }

Then in another file, say train.jsonnet, you can do this:

local common = import "common.jsonnet";

{
  steps: {
    train: { type: "...", learning_rate: common["hyperparams"]["learning_rate"] }
  }
}

epwalsh avatar Aug 25 '22 22:08 epwalsh