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

Error using torch.save after loaded and traced hubert model with infer.lib.jit.to_jit_model #2049

Open
simosechi opened this issue May 11, 2024 · 0 comments

Comments

@simosechi
Copy link
Contributor

simosechi commented May 11, 2024

I need to bring the model in c++ but I'm encountering some problem in saving hubert using TorchScript.
The following error appeare after I run torch.save for the traced model.

Could not export Python function call 'GradMultiply'. Remove calls to Python functions before export. Did you forget to add @script or @script_method annotation? If this is a nn.ModuleList, add it to __constants__

The error is reproducible using the following code

import os
import sys

now_dir = os.getcwd()
sys.path.append(now_dir)

from infer.lib.jit import to_jit_model

hb_model, traced = to_jit_model("assets/hubert/hubert_base.pt", "hubert", "trace", "assets/hubert/hubert_inputs.pth")

#after creating a folder traced
traced.save("traced/hubert_traced.pt")

I understand that maybe the problem is related with lib fairseq also, but I hope it can be resolved here

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