Skip to content

Commit aa1d426

Browse files
committed
issue resolved
1 parent d2d8339 commit aa1d426

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/transformers/utils/hub.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,6 @@ def cached_files(
583583
"Check cache directory permissions. Common causes: 1) another user is downloading the same model (please wait); "
584584
"2) a previous download was canceled and the lock file needs manual removal."
585585
) from e
586-
elif isinstance(e, ValueError):
587-
raise OSError(f"{e}") from e
588586

589587
# Now we try to recover if we can find all files correctly in the cache
590588
resolved_files = [
@@ -953,6 +951,10 @@ def push_to_hub(
953951
```
954952
"""
955953
ignore_metadata_errors = deprecated_kwargs.pop("ignore_metadata_errors", False)
954+
save_jinja_files = deprecated_kwargs.pop(
955+
"save_jinja_files", None
956+
) # TODO: This is only used for testing and should be removed once save_jinja_files becomes the default
957+
956958
repo_path_or_name = deprecated_kwargs.pop("repo_path_or_name", None)
957959
if repo_path_or_name is not None:
958960
# Should use `repo_id` instead of `repo_path_or_name`. When using `repo_path_or_name`, we try to infer
@@ -998,11 +1000,15 @@ def push_to_hub(
9981000
files_timestamps = self._get_files_timestamps(work_dir)
9991001

10001002
# Save all files.
1001-
self.save_pretrained(
1002-
work_dir,
1003-
max_shard_size=max_shard_size,
1004-
safe_serialization=safe_serialization,
1005-
)
1003+
if save_jinja_files:
1004+
self.save_pretrained(
1005+
work_dir,
1006+
max_shard_size=max_shard_size,
1007+
safe_serialization=safe_serialization,
1008+
save_jinja_files=True,
1009+
)
1010+
else:
1011+
self.save_pretrained(work_dir, max_shard_size=max_shard_size, safe_serialization=safe_serialization)
10061012

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

0 commit comments

Comments
 (0)