allenai / tango

Organize your experiments into discrete steps that can be cached and reused throughout the lifetime of your research project.
https://ai2-tango.readthedocs.io/
Apache License 2.0
532 stars 47 forks source link

Does tango provide a way to compose config files #370

Open BigRedT opened 2 years ago

BigRedT commented 2 years ago

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?

epwalsh commented 2 years ago

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?

BigRedT commented 2 years ago

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 :)

epwalsh commented 2 years ago

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"] }
  }
}