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

Python ScriptModule: Could not cast attribute 'arch_opt' to type __torch__.modules.ArchitectureOptions #2

Open
yuanyaoshen opened this issue Jul 13, 2022 · 0 comments

Comments

@yuanyaoshen
Copy link

yuanyaoshen commented Jul 13, 2022

I am trying to convert a pytorch module to ScriptModule. What I was trying to do is adding

nl_denoiser_script = torch.jit.script(nl_denoiser)
print(nl_denoiser_script.code)

after nl_denoiser.patch_denoise_net.load_state_dict(model_state0['state_dict']) in blind_denoise_bw_small.py. However, I ran into issue like:

RuntimeError: Could not cast attribute 'arch_opt' to type torch.modules.ArchitectureOptions (of Python compilation unit at: 0x518f410): Could not cast attribute 'rgb' to type Tensor: Unable to cast Python instance to C++ type (compile in debug mode for details)

I tried adding @torch.jit.script in front of class ArchitectureOptions but the same error occurred. Is there solution for this? Thank you!

@yuanyaoshen yuanyaoshen changed the title Could not cast attribute 'arch_opt' to type __torch__.modules.ArchitectureOptions Python ScriptModule: Could not cast attribute 'arch_opt' to type __torch__.modules.ArchitectureOptions Jul 13, 2022
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