0

I have some config file, model/foo.yaml:

# @package _global_
# foo.yaml
MODEL:
  BACKBONE:
    OUT_FEATURES: [c4, c5]
  HEAD:
    IN_FEATURES: ${MODEL.BACKBONE.OUT_FEATURES}

There are no issues with variable interpolation when I point to this config in the defaults-list of another config, eg buzz.yaml, except when I also override the package like so:

# buzz.yaml
defaults:
  - model@foo_head: foo

Attempting to compose buzz.yaml, you will get an error like:

omegaconf.errors.InterpolationKeyError: Interpolation key 'MODEL.BACKBONE.OUT_FEATURES' not found

Can variable interpolation not be used in configs when packaging?

Alnitak
  • 2,068
  • 2
  • 12
  • 24

1 Answers1

3

Yes. OmegaConf supports relative interpolation.

MODEL:
  BACKBONE:
    OUT_FEATURES: [c4, c5]
  HEAD:
    IN_FEATURES: ${..BACKBONE.OUT_FEATURES}

I strongly recommend that you read the docs of OmegaConf.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87