-
Notifications
You must be signed in to change notification settings - Fork 4
chore(typecheck): clean datasets/eval/export/inference; enforce mypy on 12 packages #834
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
Open
xieofxie
wants to merge
5
commits into
main
Choose a base branch
from
hualxie/typing_3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -489,6 +489,29 @@ def generate_hf_build_config( | |
| ) -> list[WinMLBuildConfig]: ... | ||
|
|
||
|
|
||
| @overload | ||
| def generate_hf_build_config( | ||
| model_id: str | None = None, | ||
| *, | ||
| task: str | None = None, | ||
| model_class: str | None = None, | ||
| model_type: str | None = None, | ||
| # Catch-all for callers that hold ``module`` as ``str | None`` (e.g. the | ||
| # ``generate_build_config`` dispatcher). Without this overload, mypy can't | ||
| # resolve the call against the two narrower overloads above and fails with | ||
| # "too many union combinations". | ||
| module: str | None, | ||
| override: WinMLBuildConfig | None = None, | ||
| shape_config: dict | None = None, | ||
| library_name: str = "transformers", | ||
| device: str = "auto", | ||
| precision: str = "auto", | ||
| trust_remote_code: bool = False, | ||
| ep: EPNameOrAlias | None = None, | ||
| no_compile: bool = False, | ||
| ) -> WinMLBuildConfig | list[WinMLBuildConfig]: ... | ||
|
xieofxie marked this conversation as resolved.
Dismissed
|
||
|
|
||
|
|
||
| def generate_hf_build_config( | ||
| model_id: str | None = None, | ||
| *, | ||
|
|
@@ -804,24 +827,24 @@ class name (HF path only). | |
| ep=ep, | ||
| override=override, | ||
| ) | ||
| # Split branches so mypy can pick the matching overload of generate_hf_build_config. | ||
| # Typed as dict[str, Any] so per-kwarg type checks happen at the callee, not on the | ||
| # widened Union mypy would otherwise infer from this heterogeneous literal. | ||
| common_kwargs: dict[str, Any] = { | ||
| "task": task, | ||
| "model_class": model_class, | ||
| "model_type": model_type, | ||
| "override": override, | ||
| "shape_config": shape_config, | ||
| "library_name": library_name, | ||
| "device": device, | ||
| "precision": precision, | ||
| "trust_remote_code": trust_remote_code, | ||
| "ep": ep, | ||
| } | ||
| if module is None: | ||
| return generate_hf_build_config(model_id, module=None, **common_kwargs) | ||
| return generate_hf_build_config(model_id, module=module, **common_kwargs) | ||
| # Single call resolves against generate_hf_build_config's `module: str | None` | ||
| # overload, which returns WinMLBuildConfig | list[WinMLBuildConfig] — matching | ||
| # this dispatcher's implementation return type. The dispatcher's own | ||
| # narrowing overloads above still tighten the return type for its callers. | ||
| return generate_hf_build_config( | ||
|
Contributor
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. revert as comment in #825 |
||
| model_id, | ||
| task=task, | ||
| model_class=model_class, | ||
| model_type=model_type, | ||
| module=module, | ||
| override=override, | ||
| shape_config=shape_config, | ||
| library_name=library_name, | ||
| device=device, | ||
| precision=precision, | ||
| trust_remote_code=trust_remote_code, | ||
| ep=ep, | ||
| ) | ||
|
|
||
|
|
||
| # ============================================================================= | ||
|
|
||
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
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.
revert of https://github.com/microsoft/winml-cli/pull/789/changes#diff-45b62ef5ac66eb35c9a46086706b3be0ecf8f6ab0f44c1eaad14df18858ab3a9