From a721d2015da29d686a3ac52ddb7ccafdefcb5b37 Mon Sep 17 00:00:00 2001 From: Yoann Schneider <yschneider@teklia.com> Date: Thu, 16 Feb 2023 09:33:19 +0100 Subject: [PATCH] clearer comments about config serialization --- dan/ocr/document/train.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dan/ocr/document/train.py b/dan/ocr/document/train.py index 3eb15552..9552d042 100644 --- a/dan/ocr/document/train.py +++ b/dan/ocr/document/train.py @@ -239,7 +239,10 @@ def get_config(): def serialize_config(config): """ - Serialize a dictionary to transform it into json and remove the credentials + Make every field of the configuration JSON-Serializable and remove sensitive information. + + - Classes are transformed using their name attribute + - Functions are casted to strings """ # Create a copy of the original config without erase it serialized_config = deepcopy(config) @@ -282,6 +285,7 @@ def serialize_config(config): "synthetic_data" in config["dataset_params"]["config"] and config["dataset_params"]["config"]["synthetic_data"] ): + # The Probability scheduler is a function and needs to be casted to string serialized_config["dataset_params"]["config"]["synthetic_data"][ "proba_scheduler_function" ] = str( -- GitLab