-
Notifications
You must be signed in to change notification settings - Fork 31.2k
Open
Labels
Description
System Info
I install the program successfully when using pip install -e .[torch].
However, I encounter the below issue when using pip install '.[torch]':
(omni) pqyin@proj54:/data2/pqyin/transformers$ python
Python 3.13.9 | packaged by Anaconda, Inc. | (main, Oct 21 2025, 19:16:10) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import transformers
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import transformers
File "/home/pqyin/miniconda3/envs/omni/lib/python3.13/site-packages/transformers/__init__.py", line 768, in <module>
sys.modules[__name__] = _LazyModule(
~~~~~~~~~~~^
__name__,
^^^^^^^^^
...<3 lines>...
extra_objects={"__version__": __version__},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/pqyin/miniconda3/envs/omni/lib/python3.13/site-packages/transformers/utils/import_utils.py", line 1847, in __init__
raise ValueError(
f"Backend should be defined in the BACKENDS_MAPPING. Offending backend: {backend}"
)
ValueError: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf
I check the module, I found that two backends tensorflow_text and tf are imported from {'models.bert.tokenization_bert_tf': {'TFBertTokenizer'}}, but tf and tensorflow_text are not in BACKENDS_MAPPING.
I found that the tokenization_bert_tf file is already deleted in the latest version, but install from pre-compiled whl file still contains the tokenization_bert_tf files. Thus incurred the import issue.
BTW, the deperated tokenization_bert_tf could be removed from type checking.
# line 25 in bert.__init__.py
from .tokenization_bert_tf import *
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
Use pip install '.[torch]
Expected behavior
File "/home/pqyin/miniconda3/envs/omni/lib/python3.13/site-packages/transformers/__init__.py", line 777, in <module>
sys.modules[__name__] = _LazyModule(
~~~~~~~~~~~^
__name__,
^^^^^^^^^
...<3 lines>...
extra_objects={"__version__": __version__},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/pqyin/miniconda3/envs/omni/lib/python3.13/site-packages/transformers/utils/import_utils.py", line 1847, in __init__
raise ValueError(
f"Backend should be defined in the BACKENDS_MAPPING. Offending backend: {backend}"
)
ValueError: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tensorflow_text