Open MattBuckley-TfN opened 5 months ago
write_metadata
function could provide an additional configs parameter which expected to be given a dictionary of BaseConfig
instances and will write those out to the YAML file using the dictionary keys.Potentially could be implemented using a BaseConfig subclass to handle saving to a YAML file an example implementation is below.
class _MetaData(BaseConfig):
tool_details: ToolDetails
system_information: SystemInformation | None = None
configs: dict[str, BaseConfig] | None = None
metadata: dict[str, Any] | None = None
def write_metadata(
path: pathlib.Path,
details: ToolDetails,
system_info: bool = True,
configs: dict[str, BaseConfig] | None = None,
save_kwargs: dict[str, Any] | None = None,
**metadata: Any,
) -> None:
if system_info:
sys_info = SystemInformation.load()
else:
sys_info = None
if save_kwargs is None:
save_kwargs = {}
data = _MetaData(
tool_details=details, system_information=sys_info, configs=configs, metadata=metadata
)
data.save_yaml(path, **save_kwargs)
Create new function in
log_helpers
for writing model metadata to a YAML file, should be givenToolDetails
and any metadata arguments.SystemInformation.load()
should be used to output that information to the YAML file.Example of the function signature below, where metadata keyword arguments can be anything which can output to a YAML file e.g. standard Python types including int, str, float, dict, list ...
Example of the output file: