-
-
Notifications
You must be signed in to change notification settings - Fork 815
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
🐛 Bug
Description
when instantiating a config object that includes interpolations, those interpolations are unexpectedly resolved in the original config object
Checklist
- I checked on the latest version of Hydra
- I created a minimal repro (See this for tips).
To reproduce
** Minimal Code/Config snippet to reproduce **
from omegaconf import OmegaConf
from hydra.utils import instantiate
def foo(**kwargs):
pass
if __name__ == "__main__":
cfg2 = OmegaConf.create(
{
'A': {
'1': 'string'
},
'B': {
'_target_': '__main__.foo',
'2': '${A.1}',
},
'C': {
'_target_': '__main__.foo',
'3': '${B}',
'4': '${A.1}'
}
}
)
print(OmegaConf.to_yaml(cfg2))
instantiate(cfg2.C)
print(OmegaConf.to_yaml(cfg2))** Stack trace/error message **
when printing cfg2 after the instantiate, B.2 now reads string where we would expect it to still read ${A.1}
A:
'1': string
B:
_target_: __main__.foo
'2': ${A.1}
C:
_target_: __main__.foo
'3': ${B}
'4': ${A.1}
A:
'1': string
B:
_target_: __main__.foo
'2': string
C:
_target_: __main__.foo
'3': ${B}
'4': ${A.1}
Expected Behavior
we expect the second print to show that B.2 is ${A.1}
A:
'1': string
B:
_target_: __main__.foo
'2': ${A.1}
C:
_target_: __main__.foo
'3': ${B}
'4': ${A.1}
A:
'1': string
B:
_target_: __main__.foo
'2': ${A.1}
C:
_target_: __main__.foo
'3': ${B}
'4': ${A.1}
System information
- Hydra Version : 1.1.1
- Python version : 3.7.10
- Virtual environment type and version :
- Operating system :
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working