Skip to content

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

@tomaarsen

Description

@tomaarsen

Hello!

Feature Request overview

  • Many example scripts use model.fit, while I softly deprecated that method in v3.0 in favor of SentenceTransformerTrainer

Details

Many example scripts use model.fit, while I softly deprecated that method in v3.0 in favor of SentenceTransformerTrainer. I wrote a migration guide here: https://sbert.net/docs/migration_guide.html#migrating-from-v2-x-to-v3-x

But never carried out the upgrade myself on all evaluation scripts. I did a bunch myself in #2622, but there's some cases that I never tackled. For some of those it might not be possible to get a 1-1 perfect match (e.g. I believe one MS MARCO script uses model.fit because then it can fully regenerate the dataset for each batch), but it should be possible to get close.

Here's some that aren't done yet: https://github.com/search?q=repo%3Ahuggingface%2Fsentence-transformers+model.fit+language%3APython+path%3A%2F%5Eexamples%5C%2Fsentence_transformer%5C%2F%2F&type=code

If you're interested in working on this, feel free to take on just one case; I'm not expecting anyone to update all of them.

  • Tom Aarsen

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions