Change8

Migrating to sentence-transformers v3.4.0

Version v3.4.0 introduces 1 breaking change. This guide details how to update your code.

Released: 1/23/2025

1
Breaking Changes
3
Migration Steps
14
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

SentenceTransformerModelCardDataSentenceTransformerTrainerlosses.CachedMultipleNegativesRankingLosslosses.CachedGISTEmbedLosslosses.CachedMultipleNegativesSymmetricRankingLosslosses.MatryoshkaLossBinaryClassificationEvaluatorTripletEvaluatorutil.mine_hard_negativesCrossEncoderHfArgumentParserSentenceTransformerTrainingArgumentsNanoBEIREvaluatorPyLate

Breaking Changes

Issue #1

SentenceTransformerModelCardData no longer stores a reference to SentenceTransformerTrainer, breaking the previous circular reference; code that accessed model_card_data.trainer must be updated to obtain the trainer elsewhere.

Migration Steps

  1. 1
    If your code accessed SentenceTransformerModelCardData.trainer, refactor to keep a separate reference to the trainer.
  2. 2
    Reinstall or upgrade to sentence-transformers==3.4.0 using pip.
  3. 3
    Review any custom module saving logic to ensure kwargs are correctly persisted.

Release Summary

Version 3.4.0 fixes a major memory‑leak issue, adds compatibility between cached losses and MatryoshkaLoss, introduces several new features, and resolves numerous bugs.

Need More Details?

View the full release notes and all changes for sentence-transformers v3.4.0.

View Full Changelog