Skip to content

Fix tokenizer saving for newer transformers versions - #1583

Closed
alperctnkaya wants to merge 1 commit into
FlagOpen:masterfrom
alperctnkaya:fix-transformers-tokenizer-save
Closed

Fix tokenizer saving for newer transformers versions#1583
alperctnkaya wants to merge 1 commit into
FlagOpen:masterfrom
alperctnkaya:fix-transformers-tokenizer-save

Conversation

@alperctnkaya

Copy link
Copy Markdown

Summary

Fix compatibility with newer transformers versions where Trainer.tokenizer is replaced by processing_class.

The current implementation crashes during checkpoint saving with:

AttributeError: 'EncoderOnlyEmbedderM3Trainer' object has no attribute 'tokenizer'

This PR:

  • keeps backward compatibility with older transformers versions
  • supports newer versions using processing_class
  • prevents checkpoint save failures during training

Tested

  • transformers==5.9.0
  • Python 3.12
  • BGE-M3 fine-tuning

@hanhainebula

Copy link
Copy Markdown
Collaborator

Thanks for your contribution! I’ve provided a more comprehensive fix for this issue in #1592, so I’ll be closing this PR. I appreciate your effort and help with improving Transformers v5 compatibility.

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

Successfully merging this pull request may close these issues.

2 participants