Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 5c92fe3

Browse files
authored
Fixed weight-only config save issue (#1373)
Fixed weight-only config save issue Signed-off-by: changwangss <chang1.wang@intel.com>
1 parent 97f0db9 commit 5c92fe3

File tree

1 file changed

+3
-3
lines changed
  • intel_extension_for_transformers/transformers/utils

1 file changed

+3
-3
lines changed

intel_extension_for_transformers/transformers/utils/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ def to_json_file(
550550
# set tokenizer to None due to it doesn't support write to json
551551
if hasattr(self, "tokenizer"):
552552
self.tokenizer = None
553+
if hasattr(self, "calib_dataloader"):
554+
self.calib_dataloader = None
553555
with open(json_file_path, "w", encoding="utf-8") as writer:
554556
writer.write(self.to_json_string(use_diff=use_diff))
555557

@@ -573,8 +575,6 @@ def save_pretrained(
573575
kwargs (`Dict[str, Any]`, *optional*):
574576
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
575577
"""
576-
# self._set_token_in_kwargs(kwargs)
577-
578578
if os.path.isfile(save_directory):
579579
raise AssertionError(
580580
f"Provided path ({save_directory}) should be a directory, not a file"
@@ -1117,4 +1117,4 @@ def to_diff_dict(self) -> Dict[str, Any]:
11171117
if value != default_config_dict[key]:
11181118
serializable_config_dict[key] = value
11191119

1120-
return serializable_config_dict
1120+
return serializable_config_dict

0 commit comments

Comments
 (0)