Question r.e. deprecation of Automatic Schema Matching #2424
Replies: 2 comments
-
My code is here. import hydra
from omegaconf import DictConfig, OmegaConf
import time
from dataclasses import dataclass, field
from hydra.core.config_store import ConfigStore
@dataclass
class InferenceConfig:
backend: str
batch_size: int
input_names: list
output_name: list = field(default_factory = lambda: list())
@dataclass
class TrainConfig:
batch_size: int
data_set: str
@dataclass
class Config:
device: str
job_name: str
inference: InferenceConfig
train: TrainConfig
cs = ConfigStore.instance()
cs.store(name="config", node=Config)
@hydra.main(config_path="conf", config_name="config", version_base='1.2.0')
def main(cfg: Config) -> None:
print(cfg)
print(OmegaConf.to_yaml(cfg))
with open('result', 'w') as f:
f.write(OmegaConf.to_yaml(cfg))
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
-
There feature you've identified is called "Automatic Schema Matching". Automatic Schema Matching means that a |
Beta Was this translation helpful? Give feedback.
-
I wrote a yaml file and want to enable type check during runtime.
It seems I can write a data class and register it with the same name with the config file.
I tried it and it worked. But I see the warning.
Will it not be supported in later versions? How can I use it?
Or if it will still be supported, the warning seems a bug?
Beta Was this translation helpful? Give feedback.
All reactions