-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Closed
Labels
bugfor patchTag issues / labels that should be included in the next patchTag issues / labels that should be included in the next patch
Description
System Info
Python 3.9 and Transformers v4.48.0
Who can help?
No response
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
v4.48.0 introduced a breaking change that happens on import of TextIteratorStreamer
Steps to reproduce
- Install Python 3.9
- Install Transformers >= v4.48.0
Run following:
from transformers import TextIteratorStreamer
Receive the following stack
Traceback (most recent call last):
File "/tmp/test/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1817, in _get_module
return importlib.import_module("." + module_name, self.__name__)
File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/tmp/test/lib/python3.9/site-packages/transformers/generation/streamers.py", line 231, in <module>
class AsyncTextIteratorStreamer(TextStreamer):
File "/tmp/test/lib/python3.9/site-packages/transformers/generation/streamers.py", line 285, in AsyncTextIteratorStreamer
self, tokenizer: "AutoTokenizer", skip_prompt: bool = False, timeout: float | None = None, **decode_kwargs
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1055, in _handle_fromlist
File "/tmp/test/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1806, in __getattr__
value = getattr(module, name)
File "/tmp/test/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1805, in __getattr__
module = self._get_module(self._class_to_module[name])
File "/tmp/test/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1819, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.generation.streamers because of the following error (look up to see its traceback):
unsupported operand type(s) for |: 'type' and 'NoneType'
Expected behavior
Work in Python 3.9
marthos1
Metadata
Metadata
Assignees
Labels
bugfor patchTag issues / labels that should be included in the next patchTag issues / labels that should be included in the next patch