Open amatsukawa opened 1 year ago
Thanks for the report, @amatsukawa.
For now, you can work around this issue using the read_write
context manager to temporarily turn off the frozen state of the config.
from omegaconf import read_write
...
with read_write(b.a):
print(OmegaConf.merge(b, {"a": {"x": 3}}))
Thanks for the response @Jasha10.
For those who come later: indeed that was the workaround I had come to, but to use merge with (1) an arbitrarily nested structured template config and (2) unknown (ahead of time) updates in the second argument of the merge, I had settled on recursively setting the readonly flag to false on every DictConfig
and ListConfig
object.
Describe the bug Merging nested readonly structured configs doesn't work.
There seems to be code to temporarily unset the read-only property of the outer-most container prior to merge to make this work in
OmegaConf.merge
. I believe the issue is that this logic needs to be recursive.To Reproduce
Expected behavior Merging nested structured readonly configs should work.