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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch.compile specializes on output name #103099

Closed
msaroufim opened this issue Jun 6, 2023 · 4 comments
Closed

torch.compile specializes on output name #103099

msaroufim opened this issue Jun 6, 2023 · 4 comments
Assignees
Labels
module: dynamo oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@msaroufim
Copy link
Member

msaroufim commented Jun 6, 2023

馃悰 Describe the bug

x-posting https://discuss.pytorch.org/t/pytorch-compile-requires-fixed-input-naming/181323

import torch
torch._dynamo.config.verbose=True

class MyModule(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.lin = torch.nn.Linear(100, 10)

    def forward(self, x, step):
        return {f'output_{step}': self.lin(x[f'input_{step}'])}

mod = MyModule()
opt_mod = torch.compile(mod)

my_input = {
    'input_0': torch.ones([100]),
    'input_1': torch.ones([100])
}

for step in range(2):
    output = opt_mod(my_input, step)
    print(output.keys())

Error logs

Expected Output

dict_keys(['output_0'])
dict_keys(['output_1'])

Actual Output

dict_keys(['output_0'])
dict_keys(['output_0'])

Minified repro

n/a

Versions

.

cc @ezyang @bdhirsh @anijain2305 @zou3519 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @gchanan @wconstab

@msaroufim msaroufim changed the title torch.compile specializes on input name torch.compile specializes on output name Jun 6, 2023
@zou3519
Copy link
Contributor

zou3519 commented Jun 6, 2023

Tentatively marking hi-pri for silent incorrectness

@malfet malfet added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module and removed triage review labels Jun 12, 2023
@zou3519
Copy link
Contributor

zou3519 commented Jun 12, 2023

@anijain2305 we marked this issue as hi-pri and you are in the feature map for Dynamo, so I assigned you as per the PT2 oncall instructions. Could you take a look please?

@voznesenskym
Copy link
Contributor

You need to take a guard on step and we don't

@mlazos
Copy link
Contributor

mlazos commented Mar 5, 2024

This has been fixed in the nightly

@mlazos mlazos closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: dynamo oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

6 participants