Skip to content

Bug:ImportError: cannot import name 'TransformGetItemToIndex' from 'torch._dynamo._trace_wrapped_higher_order_op' (/home/tiger/.local/lib/python3.10/site-packages/torch/_dynamo/_trace_wrapped_higher_order_op.py) #38362

@hswei88

Description

@hswei88

System Info

transformers:4.53.0
torch:2.5.1+cpu

Who can help?

@FightingZhen

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

i met an import error using Ascend

Here is the minimal reproducible code.
if is_torch_flex_attn_available(): from torch._dynamo._trace_wrapped_higher_order_op import TransformGetItemToIndex from torch.nn.attention.flex_attention import BlockMask, create_block_mask

Exception log
File "/home/tiger/new_verl/transformers/src/transformers/masking_utils.py", line 29, in <module> from torch._dynamo._trace_wrapped_higher_order_op import TransformGetItemToIndex ImportError: cannot import name 'TransformGetItemToIndex' from 'torch._dynamo._trace_wrapped_higher_order_op' (/home/tiger/.local/lib/python3.10/site-packages/torch/_dynamo/_trace_wrapped_higher_order_op.py)

Expected behavior

working

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions