Skip to content

Common variables? #2127

Answered by Jasha10
FeryET asked this question in Q&A
Apr 5, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

See OmegaConf's variable interpolation feature.

Are you using Hydra's instantiate API? If so, something like this should work:

# my_config.yaml
a_instance:
  _target_: my_module.A
  today: ${today}
b_instance:
  _target_: my_module.B
  today: ${today}
today: ...

The string "${today}" is a "variable interpolation". It essentially functions as a pointer to the top-level "today" key.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@aliutkus
Comment options

@Jasha10
Comment options

Jasha10 May 31, 2022
Collaborator

@aliutkus
Comment options

Answer selected by FeryET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants