Skip to content

Migrate train_bi-encoder_margin-mse.py from model.fit to SentenceTransformerTrainer#3694

Open
aryanputta wants to merge 1 commit intohuggingface:mainfrom
aryanputta:migrate-margin-mse-to-trainer
Open

Migrate train_bi-encoder_margin-mse.py from model.fit to SentenceTransformerTrainer#3694
aryanputta wants to merge 1 commit intohuggingface:mainfrom
aryanputta:migrate-margin-mse-to-trainer

Conversation

@aryanputta
Copy link

Fixes #3621

Description

This file still uses model.fit(), which was deprecated in sentence-transformers v3.0 in favor of SentenceTransformerTrainer. This updates train_bi-encoder_margin-mse.py to use SentenceTransformerTrainer and SentenceTransformerTrainingArguments. Training behavior is equivalent. This file uses MarginMSELoss, so the loss setup is unchanged — only the training loop is migrated.

Changes Made

  • Replaced model.fit() call with SentenceTransformerTrainer
  • Added SentenceTransformerTrainingArguments for training configuration
  • Replaced model.save() with model.save_pretrained()

How Was This Tested?

AI Usage Disclosure

  • No AI used.

…sformerTrainer

The model.fit() API was deprecated in sentence-transformers v3.0. This replaces it with SentenceTransformerTrainer and SentenceTransformerTrainingArguments. Training behavior is equivalent. Related to issue huggingface#3621.
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.

Update example scripts relying on model.fit to use SentenceTransformerTrainer instead

1 participant