-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting YAMLs without populating defaults #24
Comments
Hi @tovacinni! Just want to make sure I'm fully following: could you provide a concrete example of the behavior you're looking for? In particular, I'm wondering what the outputted empty YAML config file would look like. This generally sounds possible, although I'd need to think about which parts |
What I ended up doing for now is that I wrote a quick def dataclass_schema_to_dict(dataclass_class):
return_dict = {}
if not dataclasses.is_dataclass(dataclass_class):
raise Exception("The class {dataclass_class} is not a dataclass.")
for field in dataclasses.fields(dataclass_class):
if dataclasses.is_dataclass(field.type):
obj = dataclass_schema_to_dict(field.type)
return_dict[field.name] = obj
else:
return_dict[field.name] = f"{field.type.__name__}"
return return_dict This can then be dumped to a YAML, where in this case I have as default values strings indicating the argument type. Since there is support for docs in dynamic dataclasses, it might actually make more sense to output these as comments along with the docstring. batch_size: int
grid1:
base_lod: int
blas_level: int
interpolation_type: str
seed: int
train_steps: int As you say though since these steps are possible without looping in |
Hi tyro team,
First of all thanks for this super cool configuration library!! It looks awesome.
While reading the docs and playing around with the configurator I had a small question: is it possible to output a yaml file for a hierarchical config without first populating the argument defaults via the command line?
The usecase is as follows:
After defining a (hierarchical) dataclass schema, I want to populate a yaml with all null entries so that I can then populate that yaml to use as the default arguments. Ideally I can follow a flow like: 1. the code looks for a default config 2. if none exists, will populate an empty config 3. users can then populate the defaults inside the yaml, and then override the yaml with CLI arguments.
The text was updated successfully, but these errors were encountered: