-
Notifications
You must be signed in to change notification settings - Fork 7.1k
use decorator to log API usage #4976
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
Conversation
💊 CI failures summary and remediationsAs of commit 4a004a9 (more details on the Dr. CI page):
🕵️ 5 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
Job | Step | Action |
---|---|---|
Run tests | 🔁 rerun | |
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh | ||
sh conda.sh -b | ||
source $HOME/miniconda3/bin/activate | ||
conda install -yq conda-build cmake | ||
packaging/build_cmake.sh | ||
🔁 rerun | ||
packaging/build_cmake.sh | 🔁 rerun |
This comment was automatically generated by Dr. CI (expand for details).
Please report bugs/suggestions to the (internal) Dr. CI Users group.
@kazhang I tried to reproduce the problem locally but I can't. Aka pulling your branch and running the tests doesn't cause issues to me. I'm using pytorch nightly |
event = f.__module__ | ||
if f.__name__.endswith("__init__"): | ||
# inside module instantiation | ||
event += args[0].__class__.__name__ |
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.
I think we'll need a dot in the middle to preserve the previous naming (same below)
event += args[0].__class__.__name__ | |
event += "." + args[0].__class__.__name__ |
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.
Good catch, I addressed in local, but haven't pushed here yet.
@datumbox yes, I tested locally with Python
And saw the same failure as in unit test. |
I can see now why the tests passed locally. We need to pass the I don't believe decorators will be supported by JIT. I believe what happens is the from torchvision.ops.boxes import box_area,box_iou
import torch
s = torch.jit.script(box_iou)
Traceback (most recent call last):
File "<input>", line 3, in <module>
File "./torch/jit/_script.py", line 1308, in script
ast = get_jit_def(obj, obj.__name__)
File "./torch/jit/frontend.py", line 264, in get_jit_def
return build_def(parsed_def.ctx, fn_def, type_line, def_name, self_name=self_name, pdt_arg_types=pdt_arg_types)
File "./torch/jit/frontend.py", line 302, in build_def
param_list = build_param_list(ctx, py_def.args, self_name, pdt_arg_types)
File "./torch/jit/frontend.py", line 326, in build_param_list
raise NotSupportedError(ctx_range, _vararg_kwarg_err)
torch.jit.frontend.NotSupportedError: Compiled functions can't take variable number of arguments or use keyword-only arguments with defaults:
File "./vision/torchvision/utils.py", line 380
def wrapper(*args, **kwargs):
~~~~~~~ <--- HERE
event = f.__module__
if f.__name__.endswith("__init__"): This is a known limitation for JIT, so I don't think there is any way around it. |
Maybe JIT could provide its own version of functools.wraps? Or its own decorator-maker? Worth opening an issue about this in PyTorch core? Various decorators like logging or forced autocasts are useful in many contexts |
fix #4957