Skip to content

training_args module won't load with Transformers 5.0 #629

@dwvisser

Description

@dwvisser

This affects v1.1.3, as can be seen below.

Repro Steps

cd `mktemp -d`

❯ uv venv --python 3.12
Using CPython 3.12.12
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate

❯ source .venv/bin/activate

❯ uv pip install setfit
Resolved 75 packages in 55ms
Prepared 1 package in 34.26s
Installed 75 packages in 355ms
…
 + setfit==1.1.3
…
 + transformers==5.0.0
 + triton==3.6.0
 + typer-slim==0.21.1
 + typing-extensions==4.15.0
 + urllib3==2.6.3
 + xxhash==3.6.0
 + yarl==1.22.0

❯ python -c "from setfit.training_args import TrainingArguments"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/tmp.5gxvjzF3Sa/.venv/lib/python3.12/site-packages/setfit/__init__.py", line 10, in <module>
    from .span import AbsaModel, AbsaTrainer, AspectExtractor, AspectModel, PolarityModel
  File "/tmp/tmp.5gxvjzF3Sa/.venv/lib/python3.12/site-packages/setfit/span/__init__.py", line 3, in <module>
    from .trainer import AbsaTrainer
  File "/tmp/tmp.5gxvjzF3Sa/.venv/lib/python3.12/site-packages/setfit/span/trainer.py", line 8, in <module>
    from setfit.training_args import TrainingArguments
  File "/tmp/tmp.5gxvjzF3Sa/.venv/lib/python3.12/site-packages/setfit/training_args.py", line 13, in <module>
    from transformers.training_args import default_logdir
ImportError: cannot import name 'default_logdir' from 'transformers.training_args' (/tmp/tmp.5gxvjzF3Sa/.venv/lib/python3.12/site-packages/transformers/training_args.py)

Installing an older version of transformers fixed the error:

❯ uv pip install "transformers<5.0"
Resolved 18 packages in 26ms
Uninstalled 2 packages in 62ms
Installed 2 packages in 414ms
 - huggingface-hub==1.3.4
 + huggingface-hub==0.36.0
 - transformers==5.0.0
 + transformers==4.57.6

❯ python -c "from setfit.training_args import TrainingArguments"

That last command returned with a "good" zero return code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions