Skip to content

Transformers 4.39.0 has breaking change on torch compatibility. #29895

@xkszltl

Description

@xkszltl

System Info

torch 1.13 + transformers 4.39.0

Description

torch.optim.LRScheduler was only exposed in torch 2:

Previously it was called _LRScheduler in torch 1.

This recent PR included in 4.39.0 imports it and lead to a hard requirement on torch 2:

FYI @younesbelkada

This issue is captured by our CI where we have dependency on torch 1.

Expected behavior

Suggest to check on version or API availability before use.
Given it's only a visibility change, a transparent fallback/re-route would be ideal.

Metadata

Metadata

Assignees

No one assigned

    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