opensi·si

v6.0 requires transformers v5.x (up from 4.41+), torch 2.2+ (up from 1.11+), and huggingface-hub v1.x (up from 0.23+): if your environment pins any of these lower, plan those…

Migration Guide

Migrating from v5.x to v6.x

Breaking changes

v6.0 requires transformers v5.x (up from 4.41+), torch 2.2+ (up from 1.11+), and huggingface-hub v1.x (up from 0.23+): if your environment pins any of these lower, plan those upgrades first. Smaller floors also moved (numpy 1.24+, scikit-learn 1.1+, and for the train extra datasets 2.16+ and accelerate 1.3+). The minimum Python version stays 3.10.

Changed outputs and artifacts

Custom module classes require trust_remote_code=True

Loading a model whose modules.json references a module class outside of Sentence Transformers now always requires trust_remote_code=True, also when the model is stored in a local directory or when the class comes from a locally installed package. Previously, local models were implicitly trusted, and other untrusted references only emitted a FutureWarning.

Behavioral changes that need no code updates (loss bug fixes that change training results, seed reproducibility, model card regeneration differences, compatibility of new saves with older library versions) and a handful of niche API changes are covered in the release notes instead.

Migrating from PyLate

표 (15행)
PyLate Sentence Transformers
pylate.models.ColBERT(model_name_or_path=...) MultiVectorEncoder(...)
model.encode(..., is_query=True) model.encode_query(...)
model.encode(..., is_query=False) model.encode_document(...)
query_prefix="[Q] " / document_prefix="[D] " prompts={"query": "[Q] ", "document": "[D] "}
attend_to_expansion_tokens=True query_expansion={"strategy": "fixed", "attend": True, "length": 32} on the Transformer module
pylate.scores.colbert_scores model.similarity or sentence_transformers.util.maxsim
pylate.losses.Contrastive MultiVectorMultipleNegativesRankingLoss
pylate.losses.CachedContrastive CachedMultiVectorMultipleNegativesRankingLoss
temperature=X on the contrastive losses scale=1/X (the Sentence Transformers convention)
pylate.losses.Distillation MultiVectorDistillKLDivLoss
pylate.evaluation.ColBERTTripletEvaluator MultiVectorTripletEvaluator
pylate.evaluation.ColBERTDistillationEvaluator MultiVectorDistillationEvaluator
pylate.utils.KDProcessing sentence_transformers.util.resolve_ids
pylate.indexes.PLAID / pylate.retrieve.ColBERT no Sentence Transformers equivalent: keep indexing with PyLate (in a separate environment for now, as PyLate pins an older sentence-transformers version)

Note that the save compatibility is one-way: PyLate checkpoints load into MultiVectorEncoder, but models saved with MultiVectorEncoder.save_pretrained are not loadable by PyLate.

Data handling also differs from PyLate in three ways. resolve_ids expands the per-query document list into numbered columns (document_1, ..., document_N) rather than keeping a nested list, matching the (query, positive, negative_1, ...) convention of the other losses. The collators no longer skip ID-named columns silently: they warn once and tokenize them, so drop or resolve raw ID columns before training. And a document ID that is missing from its lookup dataset raises a KeyError instead of silently substituting an empty document, so pre-filter dangling IDs. String-encoded list columns (e.g. from CSV loads) are not parsed either: convert them to native lists first.

Migrating from colpali-engine

colpali-engine Sentence Transformers
ColQwen2.from_pretrained(...) + ColQwen2Processor MultiVectorEncoder("vidore/colqwen2-v1.0")
processor.process_queries(...) + model(**batch) model.encode_query(queries)
processor.process_images(...) + model(**batch) model.encode_document(images)
processor.score_multi_vector(qs, ds) model.similarity(query_embeddings, document_embeddings)
mask_non_image_embeddings=True MultiVectorMask(keep_only_token_ids=[processor.tokenizer.convert_tokens_to_ids(processor.image_token)])
HierarchicalTokenPooler HierarchicalTokenPooling (see its docstring for exact-parity notes)
colpali_engine.interpretability sentence_transformers.multi_vector_encoder.interpretability

Smaller changes

Migrating from v5.x to v5.4+

Updated import paths

Renamed methods and parameters

CrossEncoder.max_length property renamed to max_seq_length

Trainer tokenizer parameter renamed to processing_class

tokenizer_kwargs renamed to processor_kwargs

CrossEncoder API changes

Removed tags parameter from push_to_hub

Default pooling for CausalLM models

Changes for custom module and loss authors

Migrating from v4.x to v5.x

Migration for model.encode

Migration for Asym to Router

Migration of advanced usage

Migrating from v3.x to v4.x

Migration for parameters on CrossEncoder initialization and methods

Migration for specific parameters from CrossEncoder.fit

Migration for CrossEncoder evaluators

Migrating from v2.x to v3.x

Migration for specific parameters from SentenceTransformer.fit

Migration for custom Datasets and DataLoaders used in SentenceTransformer.fit

Source and license

Source: Sentence Transformers documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.