Skip to content
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

RuntimeError: Can't add a new parameter #218

Open
aizvorski opened this issue Jan 4, 2024 · 0 comments
Open

RuntimeError: Can't add a new parameter #218

aizvorski opened this issue Jan 4, 2024 · 0 comments

Comments

@aizvorski
Copy link

I'm trying to use thop on a module that is a loaded from file.

My code looks like this:

model = torch.jit.load(...)
x = ...
model(x) # this works

from thop import profile
profile(model, inputs=x) # this raises an exception
# RuntimeError: Can't add a new parameter after ScriptModule construction. Tried to add 'total_ops

What is happening - is it basically that the deserialized model is immutable and thop tries to modify it?

Is there a way around this?

Versions: thop 0.1.1 from pip, torch 1.13.0 and python 3.10.12 from conda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant