Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from quick start fails with 'TrainingArguments' object has no attribute 'eval_strategy' #528

Open
salvador-dali opened this issue May 22, 2024 · 8 comments

Comments

@salvador-dali
Copy link

Tried to follow https://huggingface.co/docs/setfit/main/en/quickstart#end-to-end

This notebook is just a copypaste from quickstart: https://colab.research.google.com/drive/1N9HPmqhaqBm_rL13nTuV3wC7rdIJseve#scrollTo=0NybX59O5o98

The train fails with

/usr/local/lib/python3.10/dist-packages/transformers/utils/notebook.py in on_train_begin(self, args, state, control, **kwargs)
    293 
    294     def on_train_begin(self, args, state, control, **kwargs):
--> 295         self.first_column = "Epoch" if args.eval_strategy == IntervalStrategy.EPOCH else "Step"
    296         self.training_loss = 0
    297         self.last_log = 0

AttributeError: 'TrainingArguments' object has no attribute 'eval_strategy'
@tomaarsen
Copy link
Member

The most recent version of transformers has renamed evaluation_strategy into eval_strategy. I'd recommend downgrading transformers to a slightly older version. You can see your current version with pip show transformers.

  • Tom Aarsen

@salvador-dali
Copy link
Author

Thanks, I was able to fix this with !pip install transformers==4.39.0

@tomaarsen
Copy link
Member

Excellent, thanks for sharing! I intend to fix this more properly in early June.

  • Tom Aarsen

@giorgionicoli
Copy link

It seems to work up to transformers==4.40.2, but it fails with transformers>=4.41.0, in case useful :)

@splevine
Copy link

splevine commented Jun 1, 2024

I was facing this issue yesterday, I will try that particular downgrade to transformers this week. Thank you!

@XeniaZerweck
Copy link

XeniaZerweck commented Jun 6, 2024

Hello, I am facing the same issue and downgrading to transformers==4.39.0 did not fix the problem. Neither did the workaround args.eval_strategy = args.evaluation_strategy. Are there any updates or any other insights? Thanks in advance!

@splevine
Copy link

splevine commented Jun 6, 2024

The transformers downgrade worked for me

If in notebook you can run:

pip install setfit transformers==4.39.0

@XeniaZerweck
Copy link

Yes it worked for me too now, I forgot to restart my kernel. Apologies and thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants