From 5c92fe31ea232fea71a179585c91644a6d079cd7 Mon Sep 17 00:00:00 2001 From: "Cheng, Penghui" Date: Wed, 13 Mar 2024 17:41:41 +0800 Subject: [PATCH] Fixed weight-only config save issue (#1373) Fixed weight-only config save issue Signed-off-by: changwangss --- .../transformers/utils/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intel_extension_for_transformers/transformers/utils/config.py b/intel_extension_for_transformers/transformers/utils/config.py index 4c958f0eb2c..2b64b4ef3a2 100644 --- a/intel_extension_for_transformers/transformers/utils/config.py +++ b/intel_extension_for_transformers/transformers/utils/config.py @@ -550,6 +550,8 @@ def to_json_file( # set tokenizer to None due to it doesn't support write to json if hasattr(self, "tokenizer"): self.tokenizer = None + if hasattr(self, "calib_dataloader"): + self.calib_dataloader = None with open(json_file_path, "w", encoding="utf-8") as writer: writer.write(self.to_json_string(use_diff=use_diff)) @@ -573,8 +575,6 @@ def save_pretrained( kwargs (`Dict[str, Any]`, *optional*): Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. """ - # self._set_token_in_kwargs(kwargs) - if os.path.isfile(save_directory): raise AssertionError( f"Provided path ({save_directory}) should be a directory, not a file" @@ -1117,4 +1117,4 @@ def to_diff_dict(self) -> Dict[str, Any]: if value != default_config_dict[key]: serializable_config_dict[key] = value - return serializable_config_dict + return serializable_config_dict