You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
fromomegaconfimportOmegaConf, MISSINGfromdataclassesimportdataclass@dataclass(frozen=True)classA:
x: int=MISSING@dataclass(frozen=True)classB:
a: A=MISSINGb: int=1# This is the configb=OmegaConf.structured(B(a=A()))
print(b)
# ==> {'a': {'x': '???'}, 'b': 1}# Worksprint(OmegaConf.merge(b, {"b": 3}))
# ==> {'a': {'x': '???'}, 'b': 3}# Doesn't workprint(OmegaConf.merge(b, {"a": {"x": 3}}))
# ...# ReadonlyConfigError: Cannot set value of read-only config node# full_key: a.x# reference_type=A# object_type=A
Expected behavior
Merging nested structured readonly configs should work.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: