You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 1, 2025. It is now read-only.
ERROR:root:unhandled error
Traceback (most recent call last):
File "./torchbench.py", line 982, in run_one_model
new_result = model_iter_fn(model, example_inputs)
File "./torchbench.py", line 470, in forward_pass
def forward_pass(mod, inputs, collect_outputs=True):
File "/home/jansel/pytorch/torch/nn/modules/module.py", line 1111, in _call_impl
return forward_call(*input, **kwargs)
File "/home/jansel/torchbenchmark/torchbenchmark/models/tacotron2/model.py", line 499, in forward
def forward(self, inputs):
File "/home/jansel/torchbenchmark/torchbenchmark/models/tacotron2/model.py", line 499, in forward
def forward(self, inputs):
File "/home/jansel/pytorch/torch/nn/modules/module.py", line 1111, in _call_impl
return forward_call(*input, **kwargs)
File "/home/jansel/torchbenchmark/torchbenchmark/models/tacotron2/model.py", line 381, in forward
def forward(self, memory, decoder_inputs, memory_lengths):
File "/home/jansel/torchbenchmark/torchbenchmark/models/tacotron2/model.py", line 254, in get_go_frame
decoder_input = Variable(memory.data.new(
File "/home/jansel/torchbenchmark/torchbenchmark/models/tacotron2/model.py", line 243, in get_go_frame
def get_go_frame(self, memory):
File "/home/jansel/torchdynamo/torchdynamo/eval_frame.py", line 58, in _fn
return fn(*args, **kwargs)
File "/home/jansel/torchdynamo/torchdynamo/profiler.py", line 168, in _wrapped
result = gm.forward(*args)
File "<eval_with_key>.7", line 6, in forward
variable = torch.autograd.variable.Variable(zero_); zero_ = None
AttributeError: 'function' object has no attribute 'Variable'
Activity
jansel commentedon Mar 31, 2022
The error message here is:
anijain2305 commentedon Apr 19, 2022
Repro here
The generated FX graph is this
For some reason, the generated FX graph has
torch.autograd.variable.Variable
, when it should have beentorch.autograd.Variable
.jansel commentedon Apr 19, 2022
This sounds like an upstream bug in pytorch.
The issue is:
I bet the following monkey patch will fix it:
anijain2305 commentedon Apr 19, 2022
Ah, its because of the overloading of the variable function
https://github.com/pytorch/pytorch/blob/master/torch/autograd/__init__.py#L298-L300
anijain2305 commentedon Apr 19, 2022
It is a bug in upstream PyTorch. But, given that
Variable
is deprecated for external use - https://pytorch.org/docs/stable/autograd.html#variable-deprecatedI suggest to change the tacotron model to use Tensors instead of Variables - https://github.com/pytorch/benchmark/blob/main/torchbenchmark/models/tacotron2/model.py#L270-L285. What do you think? @jansel
Unless the suggested change is just to add that single monkey-patch line in PyTorch
jansel commentedon Apr 19, 2022
I'd just add the following to
./torch/autograd/__init__.py
:jansel commentedon Apr 19, 2022
We could the patch on our codebase.
Monkey patch Variable module to fix FX codegen
Monkey patch Variable module to fix FX codegen (#76079)