RefChecker icon indicating copy to clipboard operation
RefChecker copied to clipboard

Deprecation issue with latest Transformers

Open AbhilashPal opened this issue 8 months ago • 1 comments

Facing the following issue regarding AdamW being removed from transformers in version 4.50 onwards I believe. The last transformers version compatible with ragchecker is 4.49 at present. It would be great if the import can be fixed :

Issue : https://github.com/huggingface/transformers/issues/36954

Error :

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/mnt/c/WorkFiles/projects/aletheia/aletheia/contrib/rag_eval/evaluate_rag.py", line 7, in <module>
    from ragchecker import RAGResults
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/ragchecker/__init__.py", line 2, in <module>
    from .evaluator import RAGChecker
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/ragchecker/evaluator.py", line 4, in <module>
    from refchecker.extractor import LLMExtractor
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/__init__.py", line 1, in <module>
    from .checker import (
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/checker/__init__.py", line 2, in <module>
    from .alignscore.alignscore_checker import AlignScoreChecker
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/checker/alignscore/__init__.py", line 1, in <module>
    from .alignscore import AlignScore
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/checker/alignscore/alignscore.py", line 1, in <module>
    from .inference import Inferencer
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/checker/alignscore/inference.py", line 5, in <module>
    from .model import BERTAlignModel
  File "/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/refchecker/checker/alignscore/model.py", line 3, in <module>
    from transformers import AdamW, get_linear_schedule_with_warmup, AutoConfig
ImportError: cannot import name 'AdamW' from 'transformers' (/home/apal/.cache/pypoetry/virtualenvs/aletheia-GIZdsgw_-py3.12/lib/python3.12/site-packages/transformers/__init__.py)

AbhilashPal avatar May 09 '25 12:05 AbhilashPal

Fixed this issue in #31.

zthang avatar May 14 '25 16:05 zthang