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

Commit

Permalink
Fixed weight-only config save issue (#1373)
Browse files Browse the repository at this point in the history
Fixed weight-only config save issue

Signed-off-by: changwangss <chang1.wang@intel.com>
  • Loading branch information
PenghuiCheng authored Mar 13, 2024
1 parent 97f0db9 commit 5c92fe3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions intel_extension_for_transformers/transformers/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit 5c92fe3

Please sign in to comment.