Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Dynamo inaccurate line number in backtrace #1462

@ezyang

Description

@ezyang

Steps to reproduce:

  1. Build 86c182c6cd3a39e02a3f3575510de5b3d2c98acd of pytorch/pytorch (current tip of Symbolic shapes pytorch#84246)
  2. Normal torchdynamo OK (tested 2e6737a)
  3. Run TORCH_SHOW_CPP_STACKTRACES=1 TORCHDYNAMO_DYNAMIC_SHAPES=1 AOT_DYNAMIC_SHAPES=1 TORCH_MONKEYPATCH_GETITEM=1 python benchmarks/torchbench.py --only hf_T5 --accuracy --backend aot_eager --training

This errors with:

  File "/home/ezyang/local/pytorch-tmp-env/lib/python3.9/site-packages/transformers/models/t5/modeling_t5.py", line 892, in forward  
    def forward(                                                  
  File "/home/ezyang/local/pytorch-tmp-env/lib/python3.9/site-packages/transformers/modeling_utils.py", line 824, in get_extended_attention_mask                                                       
    extended_attention_mask = ModuleUtilsMixin.create_extended_attention_mask_for_decoder(                                           
  File "/home/ezyang/local/pytorch-tmp-env/lib/python3.9/site-packages/transformers/modeling_utils.py", line 774, in create_extended_attention_mask_for_decoder                                        
    batch_size, seq_length = input_shape                                                                                             
TypeError: cannot unpack non-iterable int object   

Notice that the first line refers to 892, aka the function definition

      def forward(
          self,
          input_ids=None,
          attention_mask=None,
          encoder_hidden_states=None,
          encoder_attention_mask=None,
          inputs_embeds=None,
          head_mask=None,
          cross_attn_head_mask=None,
          past_key_values=None,
          use_cache=None,
          output_attentions=None,
          output_hidden_states=None,
          return_dict=None,
      ):  

This is not expected. I expect the reported line number to be 958, aka where get_extended_attention_mask is called:

>>        # We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length]
>>        # ourselves in which case we just need to make it broadcastable to all heads.
>>        extended_attention_mask = self.get_extended_attention_mask(attention_mask, input_shape)

(the dynamo error itself is unlikely to be a dynamo problem and is some transient problem with the symbolic shapes stack)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions