Skip to content

How to recover types from serialized OmegaConf? #1157

Answered by Jasha10
rhaps0dy asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, I should have read the end of your question before answering.

This is a use case that would be covered by #144, which is not yet fully implemented.
The usage pattern would look something like this:

@dataclass
class ConfigUnion:
    l: A | B = field(default_factory=A)

That A | B is a union type. Currently, running OmegaConf.merge(ConfigUnion, cfg2) gives the following error message:

omegaconf.errors.ConfigValueError: Unions of containers are not supported:
l: Union[A, B]
    full_key:
    object_type=None

Unfortunately there's no good workaround for this as far as I'm aware.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@rhaps0dy
Comment options

@Jasha10
Comment options

Answer selected by rhaps0dy
@rhaps0dy
Comment options

@rhaps0dy
Comment options

@Jasha10
Comment options

@rhaps0dy
Comment options

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