Skip to content

Commit c1fdb8c

Browse files
committed
Release: v0.26.4
1 parent 1757afb commit c1fdb8c

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/huggingface_hub/serialization/_torch.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def save_torch_model(
4141
max_shard_size: Union[int, str] = MAX_SHARD_SIZE,
4242
metadata: Optional[Dict[str, str]] = None,
4343
safe_serialization: bool = True,
44-
is_main_process: bool = True,
4544
shared_tensors_to_discard: Optional[List[str]] = None,
4645
):
4746
"""
@@ -96,10 +95,6 @@ def save_torch_model(
9695
Whether to save as safetensors, which is the default behavior. If `False`, the shards are saved as pickle.
9796
Safe serialization is recommended for security reasons. Saving as pickle is deprecated and will be removed
9897
in a future version.
99-
is_main_process (`bool`, *optional*):
100-
Whether the process calling this is the main process or not. Useful when in distributed training like
101-
TPUs and need to call this function from all processes. In this case, set `is_main_process=True` only on
102-
the main process to avoid race conditions. Defaults to True.
10398
shared_tensors_to_discard (`List[str]`, *optional*):
10499
List of tensor names to drop when saving shared tensors. If not provided and shared tensors are
105100
detected, it will drop the first name alphabetically.
@@ -127,7 +122,6 @@ def save_torch_model(
127122
metadata=metadata,
128123
safe_serialization=safe_serialization,
129124
save_directory=save_directory,
130-
is_main_process=is_main_process,
131125
shared_tensors_to_discard=shared_tensors_to_discard,
132126
)
133127

@@ -141,7 +135,6 @@ def save_torch_state_dict(
141135
max_shard_size: Union[int, str] = MAX_SHARD_SIZE,
142136
metadata: Optional[Dict[str, str]] = None,
143137
safe_serialization: bool = True,
144-
is_main_process: bool = True,
145138
shared_tensors_to_discard: Optional[List[str]] = None,
146139
) -> None:
147140
"""
@@ -196,10 +189,6 @@ def save_torch_state_dict(
196189
Whether to save as safetensors, which is the default behavior. If `False`, the shards are saved as pickle.
197190
Safe serialization is recommended for security reasons. Saving as pickle is deprecated and will be removed
198191
in a future version.
199-
is_main_process (`bool`, *optional*):
200-
Whether the process calling this is the main process or not. Useful when in distributed training like
201-
TPUs and need to call this function from all processes. In this case, set `is_main_process=True` only on
202-
the main process to avoid race conditions. Defaults to True.
203192
shared_tensors_to_discard (`List[str]`, *optional*):
204193
List of tensor names to drop when saving shared tensors. If not provided and shared tensors are
205194
detected, it will drop the first name alphabetically.

tests/test_serialization.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ def test_save_torch_model(mocker: MockerFixture, tmp_path: Path) -> None:
264264
max_shard_size="3GB",
265265
metadata={"foo": "bar"},
266266
safe_serialization=True,
267-
is_main_process=True,
268267
shared_tensors_to_discard=None,
269268
)
270269
safe_state_dict_mock.assert_called_once_with(
@@ -275,7 +274,6 @@ def test_save_torch_model(mocker: MockerFixture, tmp_path: Path) -> None:
275274
max_shard_size="3GB",
276275
metadata={"foo": "bar"},
277276
safe_serialization=True,
278-
is_main_process=True,
279277
shared_tensors_to_discard=None,
280278
)
281279

0 commit comments

Comments
 (0)