-
Notifications
You must be signed in to change notification settings - Fork 351
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
feat: Add decorator utility to improve error messaging for legacy support #1738
Conversation
80d52fe
to
1b03650
Compare
raise AssertionError( | ||
f"Expected Torch version {min_torch_version} or greater, " | ||
+ f"when calling {f}. Detected version {torch.__version__}" | ||
) |
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.
The function f
is printed in the error message, which includes its name.
- Add general-purpose utility for intercepting invalid Torch version imports and displaying an error message to the user, halting compilation - Utility automatically parses string inputs to semantic versions using the `packaging` utility package - Decorator can accept variable input versions and checks whether the current version in use in the environment is at least as large as the minimum specified version - Display clear error message upon calling the aten tracer when using a legacy Torch version, for which the Dynamo import is invalid
1b03650
to
a4efe09
Compare
@@ -104,3 +105,36 @@ def f(*inp): | |||
mod = run_const_fold(mod) | |||
mod = replace_op_with_indices(mod) | |||
return mod | |||
|
|||
|
|||
def req_torch_version(min_torch_version: str = "2.dev"): |
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.
Default is "2.dev" since "2.0" is considered to be a larger version than "2.0.0.dev____".
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.
Lgtm
Description
Fixes #1733
Type of change
Checklist: