Repository navigation
Task-scoped download counting - #85
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
snapshot-identifierper task.download_repo,snapshot_download,ms-hub downloadand report mode previously generated a fresh UUID for every file request (and thus counted repeatedly). The identifier is now created once at the task entry and propagated down through every file, worker, range part, route probe, resume and integrity retry.download_file,model_file_download,dataset_file_download, compat single-file calls and CLI explicit file arguments now omitsnapshot-identifier, so the dataset service applies its per-file counting to them instead of attributing a whole-snapshot hit.openflag are persisted in the existing hidden tracker JSON; a task that endsPARTIALorCANCELLEDkeeps its ID on rerun, while the run after aCOMPLETEtracker starts a new task.LegacyHubApinow checks the local meta-file cache before calling thedatasets/.../repoendpoint instead of after.Enhance
_build_download_headers(..., snapshot_id=...),download_repo(..., _snapshot_id=...),_download_file(..., _snapshot_id=...)and_download_with_resume(..., snapshot_id=...); a non-blank caller-supplied ID is preserved, and the header builder never generates one itself.Docs
download_file,download_repo,download_repo_report,download_snapshotand module header now describe identifier scope and cached-file behavior.Tests
tests/test_download_snapshot_identifier.py(454 lines): whole-repo inline+LFS, multi-worker, sequential and concurrent tasks on one instance, Range/disconnect/integrity retries, single-file and filtered downloads, full cache hit, root vs nested metadata files, report cancel/cross-process resume/post-COMPLETErerun, corrupt/unwritable trackers, realPreparedRequestheader capture.tests/test_modelscope_download_compatibility.pyandtests/test_download_integrity.pyfor compat passthrough and identifier stability.