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: get_parameter is not supported on ScriptModules #129247

Open
simosechi opened this issue Jun 21, 2024 · 2 comments
Open

RuntimeError: get_parameter is not supported on ScriptModules #129247

simosechi opened this issue Jun 21, 2024 · 2 comments
Labels
module: windows Windows support for PyTorch oncall: jit Add this issue/PR to JIT oncall triage queue

Comments

@simosechi
Copy link

simosechi commented Jun 21, 2024

🐛 Describe the bug

Hi everyone as the title says, I'm wondering if get_parameter is no more supported for ScriptModules.
Here a trivial example:

import torch

class InputContainer(torch.nn.Module):
    def __init__(self, obj):
        super().__init__()
        for key, value in obj.items():
            setattr(self, key, value)

inputs = {
        "audio" : torch.rand((553172,))
        }
inputs_model = InputContainer(inputs)
inputs_script = torch.jit.script(inputs_model)
inputs_script.save("rmvpe_inputs.pt")
inputs_script.get_parameter("audio")
File "c:\Users\simos\miniconda3\envs\rcv\lib\site-packages\torch\jit\_script.py", line 981, in fail
    raise RuntimeError(name + " is not supported on ScriptModules")
RuntimeError: get_parameter is not supported on ScriptModules

what does it mean? are not docs up to date?

docs ref:
https://pytorch.org/docs/stable/generated/torch.jit.ScriptModule.html#torch.jit.ScriptModule.get_parameter

Versions

PyTorch version: 2.2.2+cpu
Python version: 3.10.14

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite

@malfet malfet added oncall: jit Add this issue/PR to JIT oncall triage queue module: windows Windows support for PyTorch labels Jun 21, 2024
@malfet
Copy link
Contributor

malfet commented Jun 21, 2024

@simosechi do you know a version of pytorch when it used to work?

@simosechi
Copy link
Author

@simosechi do you know a version of pytorch when it used to work?

Not really, I just assume that it did, I know that for c++ api it's been deprecated in favor of attr function (and in this case I'm sure that docs aren't up to date). So, I tried with ScriptModule.attr() but it didn't work as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: windows Windows support for PyTorch oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
Status: Backlog
Development

No branches or pull requests

2 participants