[API] Add HfApi.copy_files method to copy files remotely#3874
Draft
[API] Add HfApi.copy_files method to copy files remotely#3874
HfApi.copy_files method to copy files remotely#3874Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Contributor
Author
|
Current status: x-bucket copies do not work. Need an extra call to CAS to tell about the xethash being registered in destination bucket |
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.
Note: required https://github.com/huggingface-internal/moon-landing/pull/17593 to be merged first. Still some testing to be done but it looks promising.
Summary
This PR adds a new
HfApi.copy_filesAPI and extendshf buckets cpto support remote HF-handle copy workflows.New capability
Copy behavior
/)Content transfer strategy
xet_hash: copied directly by hashxet_hash(regular small file): download then re-uploadAPI changes
Added
HfApi.copy_files(source, destination, *, token=None) -> Nonecopy_filesHandle support
hf://...)@revisionExamples:
hf://buckets/<namespace>/<bucket_id>/path/to/filehf://datasets/<namespace>/<dataset_id>/path/to/folder/hf://<namespace>/<model_id>/path/to/filehf://<namespace>/<model_id>@<revision>/path/to/fileInternal update
Extended
_batch_bucket_filesinternals to accept prebuilt_BucketAddFileentries, allowing direct hash-based add operations when hash metadata is already known.CLI changes
Updated
hf buckets cp:api.copy_filesCopied: SRC -> DSTTests added
tests/test_buckets.pytest_copy_files_bucket_to_same_bucket_filetest_copy_files_bucket_to_different_bucket_foldertest_copy_files_repo_to_bucket_with_revisiontest_copy_files_bucket_to_repo_raisestest_copy_files_folder_requires_destination_suffixtests/test_buckets_cli.pytest_cp_remote_bucket_to_buckettest_cp_remote_repo_to_buckettest_cp_error_bucket_to_repotest_cp_error_remote_folder_requires_destination_suffixDocumentation
Updated:
docs/source/en/guides/buckets.mddocs/source/en/guides/cli.mddocs/source/en/package_reference/cli.md(generated)