●Change8

v4.1.0

πŸ“¦ sentence-transformersView on GitHub β†’
✨ 5 featuresπŸ› 1 fixesπŸ”§ 2 symbols

Summary

Version 4.1.0 adds ONNX and OpenVINO backends for CrossEncoder, a new `backend` argument, and utilities for model optimization, while remaining backward compatible.

Migration Steps

  1. Install the new version using the appropriate extra, e.g., `pip install sentence-transformers[onnx]==4.1.0` for ONNX support.
  2. If you want to use the new backends, pass `backend="onnx"` or `backend="openvino"` when constructing a `CrossEncoder`.
  3. After first export, push the exported model to the hub or save it with `model.save_pretrained` to avoid re‑export on subsequent loads.
  4. Update any custom code that relied on implicit model loading to handle the new `model_kwargs` passed to the underlying Optimum model if needed.

✨ New Features

  • Added ONNX and OpenVINO backends for CrossEncoder with a new `backend` argument (values: "torch" (default), "onnx", "openvino").
  • Enabled automatic export of ONNX/OpenVINO models when not present in the repository.
  • Added helper function `export_optimized_onnx_model` for ONNX optimization and quantization.
  • Improved hard negatives mining strategies.
  • Provided pip extras for ONNX GPU, ONNX CPU, and OpenVINO installations.

πŸ› Bug Fixes

  • Minor improvements and bug fixes.

πŸ”§ Affected Symbols

CrossEncoderexport_optimized_onnx_model