Skip to content

Commit e812178

Browse files
committed
Working!
1 parent eea8a3a commit e812178

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/transformers/tokenization_utils_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ def from_pretrained(
20062006
if not template_file.path.endswith(".jinja"):
20072007
continue
20082008
template_name = template_file.path.split("/")[-1].removesuffix(".jinja")
2009-
additional_files_names[f"chat_template_{template_name}"] = template_file
2009+
additional_files_names[f"chat_template_{template_name}"] = template_file.path
20102010
except EntryNotFoundError:
20112011
pass # No template dir means no template files
20122012

src/transformers/utils/hub.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ def push_to_hub(
829829
"""
830830
use_auth_token = deprecated_kwargs.pop("use_auth_token", None)
831831
ignore_metadata_errors = deprecated_kwargs.pop("ignore_metadata_errors", False)
832+
save_raw_chat_template = deprecated_kwargs.pop("save_raw_chat_template", None) # Temporary and only for testing
832833
if use_auth_token is not None:
833834
warnings.warn(
834835
"The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.",
@@ -885,7 +886,10 @@ def push_to_hub(
885886
files_timestamps = self._get_files_timestamps(work_dir)
886887

887888
# Save all files.
888-
self.save_pretrained(work_dir, max_shard_size=max_shard_size, safe_serialization=safe_serialization)
889+
if save_raw_chat_template:
890+
self.save_pretrained(work_dir, max_shard_size=max_shard_size, safe_serialization=safe_serialization, save_raw_chat_template=True)
891+
else:
892+
self.save_pretrained(work_dir, max_shard_size=max_shard_size, safe_serialization=safe_serialization)
889893

890894
# Update model card if needed:
891895
model_card.save(os.path.join(work_dir, "README.md"))

0 commit comments

Comments
 (0)