-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Cheap CLI #42447
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
Cheap CLI #42447
Changes from 4 commits
6ab0484
00ca93c
48462c7
070bb8c
ee9efd1
d8cbd57
0a6e964
ff9571b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
| from transformers.cli.add_new_model_like import add_new_model_like | ||
| from transformers.cli.chat import Chat, ChatCommand | ||
| from transformers.cli.download import download | ||
| from transformers.cli.run import run | ||
| from transformers.cli.serve import Serve | ||
| from transformers.cli.system import env, version | ||
|
|
||
|
|
@@ -31,7 +30,6 @@ | |
| app.command(name="chat", cls=ChatCommand)(Chat) | ||
| app.command()(download) | ||
| app.command()(env) | ||
| app.command()(run) | ||
|
Contributor
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. Is this intentional? If yes, can the
Contributor
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. And if removed, would be good to mention it in PR description + migration guide. Apart from that the PR looks good to me (haven't run it locally though)
Member
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. Done! Thanks @Wauplin |
||
| app.command(name="serve")(Serve) | ||
| app.command()(version) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| from types import ModuleType | ||
| from typing import Any | ||
|
|
||
| import packaging.version | ||
| from packaging import version | ||
|
|
||
| from . import logging | ||
|
|
@@ -92,10 +93,14 @@ def _is_package_available(pkg_name: str, return_version: bool = False) -> tuple[ | |
|
|
||
| @lru_cache | ||
| def is_torch_available() -> bool: | ||
| is_available, torch_version = _is_package_available("torch", return_version=True) | ||
| if is_available and version.parse(torch_version) < version.parse("2.2.0"): | ||
| logger.warning_once(f"Disabling PyTorch because PyTorch >= 2.2 is required but found {torch_version}") | ||
| return is_available and version.parse(torch_version) >= version.parse("2.2.0") | ||
| try: | ||
| is_available, torch_version = _is_package_available("torch", return_version=True) | ||
| parsed_version = version.parse(torch_version) | ||
| if is_available and parsed_version < version.parse("2.2.0"): | ||
| logger.warning_once(f"Disabling PyTorch because PyTorch >= 2.2 is required but found {torch_version}") | ||
| return is_available and version.parse(torch_version) >= version.parse("2.2.0") | ||
| except packaging.version.InvalidVersion: | ||
| return False | ||
|
Comment on lines
+96
to
+103
Member
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. Happy to revert this; I ran into an edge-case when uninstalling This is a bit out of scope of that PR so happy to revert it
Contributor
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. just saw that, isn't that caused by the lru_cache maybe? |
||
|
|
||
|
|
||
| @lru_cache | ||
|
|
||
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.
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.
It's fix 2 out of 3 for the GPT OSS family of models :)