You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix the transformers example when running with 4.57.0 #331
After the release of transformers 4.57.0, the CI related to transformers started failing. To temporarily resolve the issue, I opened a PR to add the version constraint. This issue proposes resolving the failure.
Traceback (most recent call last):
File "/home/runner/work/optuna-examples/optuna-examples/transformers/transformers_simple.py", line 17, in <module>
from transformers import Trainer
File "<frozen importlib._bootstrap>", line 1055, in _handle_fromlist
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 2317, in __getattr__
module = self._get_module(self._class_to_module[name])
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 2347, in _get_module
raise e
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 2345, in _get_module
return importlib.import_module("." + module_name, self.__name__)
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/transformers/trainer.py", line 311, in <module>
class Trainer:
File "/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/transformers/trainer.py", line 5593, in Trainer
def _get_num_items_in_batch(self, batch_samples: list, device: torch.device) -> int | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Activity
ParagEkbote commentedon Oct 7, 2025
Looks like there was a breaking change while refactoring and a patch version should be released soon.
Reference PR