Skip to content

Compatibility issue with recent transformers versions causes model loading and prediction errors #82

@P0L3

Description

@P0L3

When using recent versions of the transformers library (4.57.1), loading a SpanMarkerModel fails with the following error:
AttributeError: 'SpanMarkerConfig' object has no attribute '_attn_implementation_internal'

Downgrading transformers to version 4.50.0 or older resolves the loading issue. However, model.predict() then fails with a ValueError, even with valid input types:
ValueError: text input must be of type 'str' (single example), 'List[str]' (batch or single pretokenized example) or 'List[List[str]]' (batch of pretokenized examples).

This was tested using: model_loading.ipynb notebook example on Google Colab with Python 3.12.12 (22.10.2025.).

My run: model_loading.ipynb.

Environment:

  • span_marker: 1.7.0

  • transformers: 4.57.1 (fails to load), 4.50.0 (loads, but prediction fails)

Suggested Fix:

Update SpanMarkerConfig and SpanMarkerModel to be compatible with the latest transformers API. Consider adding version constraints to dependencies as a temporary solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions