adapters icon indicating copy to clipboard operation
adapters copied to clipboard

ImportError: cannot import name 'BERT_INPUTS_DOCSTRING' from 'transformers.models.bert.modeling_bert'

Open rasmi opened this issue 6 months ago • 1 comments

models/bert /adapter_model.py tries to import BERT_INPUTS_DOCSTRING and BERT_START_DOCSTRING, which results in the following error in transformers v4.52.4:

E   ImportError: cannot import name 'BERT_INPUTS_DOCSTRING' from 'transformers.models.bert.modeling_bert' 

To reproduce

Steps to reproduce the behavior:

  1. Run the following tests:
  • tests/test_misc/test_adapter_safetensors.py
  • tests/test_misc/test_adapter_save_id2label.py These both call: from adapters import BertAdapterModel Which then calls:
from transformers.models.bert.modeling_bert import (
    BERT_INPUTS_DOCSTRING,
    BERT_START_DOCSTRING,
    BertModel,
    BertPreTrainedModel,
)

These were removed in this commit (this PR), which was released in transformers v4.52.1.

rasmi avatar Jun 20 '25 13:06 rasmi

You can track the following pull request.

FahadEbrahim avatar Jun 30 '25 14:06 FahadEbrahim