Skip to content
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

default flow style, change in api #9

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dnn_reco/create_trafo_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ def main(config_files):
)

with open(trafo_config_file, "w") as yaml_file:
yaml.YAML(typ="full").dump(
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
config,
yaml_file,
default_flow_style=False,
)
data_transformer.save_trafo_model(config["trafo_model_path"])

Expand Down
21 changes: 17 additions & 4 deletions dnn_reco/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ def main(config_files, output_folder, data_settings, logs):
"num_misc": data_handler.num_misc,
}
with open(os.path.join(output_folder, "config_meta_data.yaml"), "w") as f:
yaml.YAML(typ="full").dump(meta_data, f, default_flow_style=False)
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
meta_data,
f,
)

# ------------------------------------
# Export package versions and git hash
Expand All @@ -183,8 +188,11 @@ def main(config_files, output_folder, data_settings, logs):
"pip_installed_packages": config["pip_installed_packages"],
}
with open(os.path.join(output_folder, "version_control.yaml"), "w") as f:
yaml.YAML(typ="full").dump(
version_control, f, default_flow_style=False
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
version_control,
f,
)

# -------------------------------
Expand Down Expand Up @@ -294,7 +302,12 @@ def export_data_settings(data_settings, output_folder):
with open(
os.path.join(output_folder, "config_data_settings.yaml"), "w"
) as f:
yaml.YAML(typ="full").dump(data_settings, f, default_flow_style=False)
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
data_settings,
f,
)


if __name__ == "__main__":
Expand Down
12 changes: 8 additions & 4 deletions dnn_reco/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,17 +1134,21 @@ def _save_training_config(self, iteration):
del training_config["tf_float_precision"]

with open(self._training_config_file, "w") as yaml_file:
yaml.YAML(typ="full").dump(
training_config, yaml_file, default_flow_style=False
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
training_config,
yaml_file,
)

# update number of training iterations in training_steps.yaml
self._training_iterations_dict[self._training_step] = iteration
with open(self._training_steps_file, "w") as yaml_file:
yaml.YAML(typ="full").dump(
yaml_obj = yaml.YAML(typ="full")
yaml_obj.default_flow_style = False
yaml_obj.dump(
self._training_iterations_dict,
yaml_file,
default_flow_style=False,
)

def count_parameters(self, var_list=None):
Expand Down
Loading