-
-
Notifications
You must be signed in to change notification settings - Fork 412
torch.jit.load causes an error when using scalene #908
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
Comments
We need a minimum working example so we can reproduce and debug this issue. |
Try downgrading to an earlier version. Version 1.5.51 gives me the same error message when loading a torch.jit model, even though its not in the scope of the profiling. |
Can you provide a small code snippet that demonstrates the issue? |
Sure! Here is the majorly simplifed code I'm trying to run:
I'm using the following command to run the script (error trace at the end of my comment):
(But its the same with Package versions (installed with pip): It's working fine with scalene-1.5.48.
|
I need something I can run; this code, as is, does not. I had to modify the keyword on line 8 to |
Hi, I'm joining the thread. Here's a simple example: import clip
import torch
if __name__ == "__main__":
# Example usage
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
print("Model loaded successfully.") RequirementsPython
[Edit: I don't know if it somehow matters, this was tested using conda, everything installed with pip] Scalene "commands"I tried running with:
Here's the error trace: > python3 -m scalene temp.py
Error in program being profiled:
type object 'RecursiveScriptModule' has no attribute '_construct'
Traceback (most recent call last):
File "/REDACTED/python3.10/site-packages/scalene/scalene_profiler.py", line 1767, in profile_code
exec(code, the_globals, the_locals)
File "/home/ettore/Projects/uni/dl/clip-tta/temp.py", line 7, in <module>
model, preprocess = clip.load("ViT-B/32", device="cuda", jit=False)
File "/REDACTED/python3.10/site-packages/clip/clip.py", line 129, in load
model = torch.jit.load(opened_file, map_location=device if jit else "cpu").eval()
File "/REDACTED/python3.10/site-packages/torch/jit/_serialization.py", line 165, in load
return wrap_cpp_module(cpp_module)
File "/REDACTED/python3.10/site-packages/torch/jit/_recursive.py", line 1030, in wrap_cpp_module
return torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
AttributeError: type object 'RecursiveScriptModule' has no attribute '_construct' |
Reproduced. Working on a solution. |
Describe the bug
I have some code that loads a pytorch model with
torch.jit.load
. Things run fine when running the script normally, but when adding scalene withpython -m scalene <program.py>
it breaks.Screenshots
The text was updated successfully, but these errors were encountered: