From f3df24844fb9338c5646ae41111cfde595e1ef5b Mon Sep 17 00:00:00 2001 From: carefree0910 Date: Sat, 26 Dec 2020 12:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8`v0.1.9`=20patch:=20`ModelConfig`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supported assigning `extractor_config`, `head_config`, etc. explicitly. --- cflearn/api/basic.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cflearn/api/basic.py b/cflearn/api/basic.py index 0e3467d5a..a8ea6dc0d 100644 --- a/cflearn/api/basic.py +++ b/cflearn/api/basic.py @@ -65,14 +65,26 @@ def __init__( def transform_config(self) -> Dict[str, Any]: return self.meta_config.setdefault("transform", {}) + @transform_config.setter + def transform_config(self, value: Dict[str, Any]) -> None: + self.meta_config["transform"] = value + @property def extractor_config(self) -> Dict[str, Any]: return self.meta_config.setdefault("extractor", {}) + @extractor_config.setter + def extractor_config(self, value: Dict[str, Any]) -> None: + self.meta_config["extractor"] = value + @property def head_config(self) -> Dict[str, Any]: return self.meta_config.setdefault("head", {}) + @head_config.setter + def head_config(self, value: Dict[str, Any]) -> None: + self.meta_config["head"] = value + def replace(self, **kwargs: Any) -> None: pipe_config_dict = self.pipe_config._asdict() pipe_config_dict.update(kwargs)