Change8

Migrating to sentence-transformers v5.4.1

Version v5.4.1 introduces 1 breaking change. This guide details how to update your code.

Released: 4/14/2026

1
Breaking Changes
2
Migration Steps
4
Affected Symbols

⚠️ Check Your Code

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

encode()predict()DenseSentenceTransformer

Breaking Changes

Issue #1

Loading of activation functions in the `Dense` module is now restricted. Previously, any importable Python callable specified in a model's config could be loaded. Now, only activation functions whose import path starts with `torch.` are loaded by default. To load models with custom (non-torch) activation functions, you must explicitly set `trust_remote_code=True` during model initialization.

Migration Steps

  1. 1
    If loading a model that uses a custom (non-torch) activation function in its `Dense` layers, initialize the model with `trust_remote_code=True` (e.g., `SentenceTransformer("model_name", trust_remote_code=True)`).
  2. 2
    If relying on the old behavior where `model.encode(df["text"].to_numpy())` was treated as a single input when the numpy array was 1D string/object type, this behavior has changed; it is now treated as a batch of inputs.

Release Summary

This patch release enhances input handling for numpy string/object arrays in `encode()` and `predict()` and introduces a critical security fix by restricting activation function loading in the `Dense` module.

Need More Details?

View the full release notes and all changes for sentence-transformers v5.4.1.

View Full Changelog