Skip to content

Package syntax in defaults list overrides (structured configs) #2126

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

You must be logged in to vote

Hi @addisonklinke,
The following will do the trick:

@dataclass
class DatasetConf:
    defaults: List[Any] = field(default_factory=lambda: [
        {'/datamodule/prepper@_group_': 'crop'},
    ])
    batch_size: int = 2

There are three changes I've to DatasetConf's defaults list:

  • Removed the "override" keyword
  • Changed datamodule/prepper to /datamodule/prepper
  • Changed _global_ to _group_

Why not use the "override" keyword?

The error message you pasted above says "Could not find override ..."
The "override" keyword only applies you are using a defaults list to select an option from a group that is already present in some other config's defaults list. I'll circle back to give an example at…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@addisonklinke
Comment options

@Jasha10
Comment options

Jasha10 Apr 7, 2022
Collaborator

Answer selected by addisonklinke
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