Skip to content

Commit f72ba15

Browse files
davanstrienhanouticelina
authored andcommitted
Update MAX_FILE_SIZE_GB from 50 to 200 to match hub-docs PR #2169 (#3696)
1 parent 1260e32 commit f72ba15

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/huggingface_hub/_upload_large_folder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# Repository limits (from https://huggingface.co/docs/hub/repositories-recommendations)
5151
MAX_FILES_PER_REPO = 100_000 # Recommended maximum number of files per repository
5252
MAX_FILES_PER_FOLDER = 10_000 # Recommended maximum number of files per folder
53-
MAX_FILE_SIZE_GB = 50 # Hard limit for individual file size
53+
MAX_FILE_SIZE_GB = 200 # Recommended maximum for individual file size (split larger files)
5454
RECOMMENDED_FILE_SIZE_GB = 20 # Recommended maximum for individual file size
5555

5656

@@ -64,7 +64,7 @@ def _validate_upload_limits(paths_list: list[LocalUploadFilePaths]) -> None:
6464
Warns about:
6565
- Too many files in the repository (>100k)
6666
- Too many entries (files or subdirectories) in a single folder (>10k)
67-
- Files exceeding size limits (>20GB recommended, >50GB hard limit)
67+
- Files exceeding size limits (>20GB recommended, >200GB maximum)
6868
"""
6969
logger.info("Running validation checks on files to upload...")
7070

@@ -127,14 +127,14 @@ def _validate_upload_limits(paths_list: list[LocalUploadFilePaths]) -> None:
127127
elif size_gb > RECOMMENDED_FILE_SIZE_GB:
128128
large_files.append((paths.path_in_repo, size_gb))
129129

130-
# Warn about very large files (>50GB)
130+
# Warn about very large files (>200GB)
131131
if very_large_files:
132132
files_str = "\n - ".join(f"{path}: {size:.1f}GB" for path, size in very_large_files[:5])
133133
more_str = f"\n ... and {len(very_large_files) - 5} more files" if len(very_large_files) > 5 else ""
134134
logger.warning(
135-
f"Found {len(very_large_files)} files exceeding the {MAX_FILE_SIZE_GB}GB hard limit:\n"
135+
f"Found {len(very_large_files)} files exceeding the {MAX_FILE_SIZE_GB}GB recommended maximum:\n"
136136
f" - {files_str}{more_str}\n"
137-
f"These files may fail to upload. Consider splitting them into smaller chunks."
137+
f"Consider splitting these files into smaller chunks."
138138
)
139139

140140
# Warn about large files (>20GB)

tests/test_upload_large_folder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ def test_file_size_decimal_gb(self, mock_logger):
129129

130130
@patch("huggingface_hub._upload_large_folder.logger")
131131
def test_very_large_file_warning(self, mock_logger):
132-
"""Test warning for files exceeding hard limit (50GB)."""
133-
# Create a file that's 51 GB
134-
size_bytes = 51 * 1_000_000_000
132+
"""Test warning for files exceeding recommended maximum (200GB)."""
133+
# Create a file that's 201 GB
134+
size_bytes = 201 * 1_000_000_000
135135
paths = [self.MockPath("huge_file.bin", size_bytes=size_bytes)]
136136

137137
_validate_upload_limits(paths)
138138

139-
# Should warn about file exceeding 50GB hard limit
139+
# Should warn about file exceeding 200GB recommended maximum
140140
warning_calls = [str(call) for call in mock_logger.warning.call_args_list]
141-
assert any("51.0GB" in call or "51GB" in call for call in warning_calls)
142-
assert any("50GB hard limit" in call for call in warning_calls)
141+
assert any("201.0GB" in call or "201GB" in call for call in warning_calls)
142+
assert any("200GB recommended maximum" in call for call in warning_calls)
143143

144144
@patch("huggingface_hub._upload_large_folder.logger")
145145
def test_nested_directory_structure(self, mock_logger):

0 commit comments

Comments
 (0)