-
Notifications
You must be signed in to change notification settings - Fork 81
feat: resolve repo type and fetch accordingly #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
191a5be
feat: resolve repo type and fetch accordingly
drbh 030145f
fix: lint and format and prefer pinning hfh commit
drbh 5a769bc
fix: pin hub library from git commit
drbh 7b4f823
fix: update tests to specify repo type
drbh 95af15f
fix: bump overlay
drbh 5baaf3e
fix: prefer the hfh release
drbh f9b90c9
fix: bump hf xet
drbh 1f37cd9
fix: improve _resolve_repo_type
drbh 5d2a465
fix: remove debug line
drbh 2e346bf
fix: prefer repo_info in _resolve_repo_type and handle 401
drbh b263480
fix: expect repo type model for the kernels-test org kernels
drbh 27a8511
fix: adjust error
drbh df77384
fix: adjust tests and reo type resolution
drbh 3846877
fix: accept revision in _resolve_repo_type
drbh 78beca0
fix: get file metadata in repo info and remove extra try
drbh a16847b
feat: run lock pytest as subprocess
drbh 3e7dc01
feat: prefer locking kernel repo hashes
drbh 4a9ea8a
fix: avoid deprecation warning for now
drbh 6f71720
feat: make repo type optional and comment for siblings
drbh 2ab8262
fix: remove repo_type from all public interfaces
drbh b26b7f6
fix: remove backward compat of model repo types
drbh d1722af
fix: improve error cases
drbh 9c48e38
fix: bump lock files for kernel repos
drbh db72e5d
fix: avoid non version locking tests
drbh 1a15029
fix: avoid upload changes
drbh e8095a9
fix: apply lints after rebase
drbh c7ef910
fix: adjust repo not found error regression
drbh ef80f07
fix: adjust repo not found error regression in layer test too
drbh ef46c95
fix: revert back to hfhub error until 401 resolved
drbh e553a8b
fix: avoid the unneeded removal of repo type
drbh 5f5926f
feat: enforce kwargs
drbh 9448ba3
fix: adjust for kwarg
drbh 95a0316
fix: update test for kwarg changes
drbh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,7 @@ def _import_from_path( | |
|
|
||
| def install_kernel( | ||
| repo_id: str, | ||
| *, | ||
|
danieldk marked this conversation as resolved.
|
||
| revision: str, | ||
| local_files_only: bool = False, | ||
| backend: str | None = None, | ||
|
|
@@ -176,10 +177,12 @@ def install_kernel( | |
| ) | ||
|
|
||
| allow_patterns = [f"build/{variant.variant_str}/*"] | ||
|
|
||
| repo_path = Path( | ||
| str( | ||
| api.snapshot_download( | ||
| repo_id, | ||
| repo_type="kernel", | ||
| allow_patterns=allow_patterns, | ||
| cache_dir=CACHE_DIR, | ||
| revision=revision, | ||
|
|
@@ -234,15 +237,18 @@ def _find_kernel_in_repo_path( | |
|
|
||
| def install_kernel_all_variants( | ||
| repo_id: str, | ||
| *, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| revision: str, | ||
| local_files_only: bool = False, | ||
| variant_locks: dict[str, VariantLock] | None = None, | ||
| ) -> Path: | ||
| api = _get_hf_api() | ||
|
|
||
| repo_path = Path( | ||
| str( | ||
| api.snapshot_download( | ||
| repo_id, | ||
| repo_type="kernel", | ||
| allow_patterns="build/*", | ||
| cache_dir=CACHE_DIR, | ||
| revision=revision, | ||
|
|
@@ -318,7 +324,10 @@ def get_kernel( | |
| backend=backend, | ||
| ) | ||
| package_name, variant_path = install_kernel( | ||
| repo_id, revision=revision, backend=backend, user_agent=user_agent | ||
| repo_id, | ||
| revision=revision, | ||
| backend=backend, | ||
| user_agent=user_agent, | ||
| ) | ||
| return _import_from_path(package_name, variant_path, _repo_infos=repo_infos) | ||
|
|
||
|
|
@@ -396,6 +405,7 @@ def has_kernel( | |
| for init_file in ["__init__.py", f"{package_name}/__init__.py"]: | ||
| if api.file_exists( | ||
| repo_id, | ||
| repo_type="kernel", | ||
| revision=revision, | ||
| filename=f"build/{variant.variant_str}/{init_file}", | ||
| ): | ||
|
|
@@ -454,6 +464,7 @@ def load_kernel( | |
| str( | ||
| api.snapshot_download( | ||
| repo_id, | ||
| repo_type="kernel", | ||
| allow_patterns=allow_patterns, | ||
| cache_dir=CACHE_DIR, | ||
| revision=locked_sha, | ||
|
|
@@ -495,7 +506,7 @@ def get_locked_kernel(repo_id: str, local_files_only: bool = False) -> ModuleTyp | |
| raise ValueError(f"Kernel `{repo_id}` is not locked") | ||
|
|
||
| package_name, variant_path = install_kernel( | ||
| repo_id, locked_sha, local_files_only=local_files_only | ||
| repo_id, revision=locked_sha, local_files_only=local_files_only | ||
| ) | ||
|
|
||
| return _import_from_path(package_name, variant_path) | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
repo_type="kernel"here? (same above)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
repo_type="kernel"in this case since we plan to fully remove this upload file and all of the upload logic on the python cli in a following PR.I removed
repo_type="model"but realize that was unneeded - however in this case I don't think is technically changes any of the logic since if I understand correctly the default functionality is to push to model repos.however as mentioned this will all be removed in the next PR I open since we are cleaning up deprecated paths for the v0.14.0 release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes indeed, "model" is the default repo type
Got it!