Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
281 commits
Select commit Hold shift + click to select a range
bd5e23b
Add TODO in code
tomaarsen Dec 16, 2025
1439548
Merge branch 'main' into refactor/multimodal
tomaarsen Dec 19, 2025
a91ab2d
Extend "messages" support for all model archetypes, uses chat_template
tomaarsen Dec 19, 2025
181bda8
Update the ruff pre-commit hooks slightly
tomaarsen Dec 19, 2025
31c6e35
Add show-fixes to get an idea of what's meant to be failing in pre-co…
tomaarsen Dec 19, 2025
b3cb2d8
Update the Pooling import
tomaarsen Dec 19, 2025
2422a2d
Formalize deprecated imports
tomaarsen Dec 23, 2025
a5ae50f
Add simple __repr__ to Module superclass
tomaarsen Dec 23, 2025
2d23def
Revert to simply sys.modules aliasing to avoid different instances o…
tomaarsen Dec 23, 2025
ea61bef
Ignore unresolved-attribute with ty
tomaarsen Dec 23, 2025
56ed228
Work towards transformers v4 compatibility as well
tomaarsen Dec 23, 2025
a975121
Patch Asym import
tomaarsen Dec 23, 2025
0425b44
Fix typo in module output name
tomaarsen Dec 23, 2025
1cb7d10
Also use unreleased accelerate for transormers <5
tomaarsen Dec 23, 2025
3c55e8b
Merge branch 'main' into refactor/multimodal
tomaarsen Dec 23, 2025
63eefee
Update typings/type hints
tomaarsen Dec 29, 2025
0d2ffed
Update import etc. paths in documentation;
tomaarsen Dec 29, 2025
9479037
Resolve dozens of documentation warnings and issues
tomaarsen Dec 29, 2025
4cdbd83
Add 'base' to API Reference
tomaarsen Dec 29, 2025
30508ba
Move LoggingHandler to util
tomaarsen Dec 29, 2025
6084653
Update CrossEncoder training_overview docs, add cross_encoder/models …
tomaarsen Dec 29, 2025
880469e
Fix various links in training_overview for all 3 architectures, remov…
tomaarsen Dec 29, 2025
6ecba84
Simplify ONNX/OV optimization by using 'model.transformers_model'
tomaarsen Dec 30, 2025
3997067
Add is_singular_input, disallow singular inputs in preprocess
tomaarsen Dec 30, 2025
6b47d31
Improve typings for preprocess, encode, predict, etc. w. multimodality
tomaarsen Dec 30, 2025
5eb13a8
Update typings with model loading
tomaarsen Dec 30, 2025
fac2e26
Remove last Modality.all()
tomaarsen Dec 30, 2025
488e7b6
Merge branch 'main' into refactor/multimodal
tomaarsen Feb 5, 2026
c8a3ee9
Heavily refactor multimodality further; focus on message and tests
tomaarsen Feb 13, 2026
6e90205
Add query/document style message format for rerankers
tomaarsen Feb 16, 2026
7cef666
Merge branch 'main' into refactor/multimodal
tomaarsen Feb 16, 2026
5e5619b
Fix some updated imports
tomaarsen Feb 16, 2026
003fb7f
If model.forward can't be inspected, assume model.forward is fine
tomaarsen Feb 16, 2026
9034b5c
Replace prajjwal1/bert-tiny due to issues loading with AutoConfig
tomaarsen Feb 16, 2026
fe59c13
Allow for pairs of inputs a bit easier
tomaarsen Feb 16, 2026
342416e
Add torchcodec to test suite
tomaarsen Feb 16, 2026
f5db2ed
Expand on test suite even further, discover more issues
tomaarsen Feb 16, 2026
21088fc
Link directly to transformers issue explaining why try-except exists
tomaarsen Feb 17, 2026
d2fa782
Merge branch 'main' into refactor/multimodal
tomaarsen Mar 2, 2026
181bb2d
Revert to only passing text & common kwargs in apply_chat_template
tomaarsen Mar 2, 2026
bc6c367
Remove completed TODO
tomaarsen Mar 2, 2026
ac719ab
Skip extensive test_transformer_auto.py tests on CI
tomaarsen Mar 2, 2026
4e64a73
Separate apply_chat_template for processor and tokenizer, separate args
tomaarsen Mar 2, 2026
46e19a3
Add 5 extra tiny-random models, all work
tomaarsen Mar 2, 2026
f8c6726
Merge branch 'main' into refactor/multimodal
tomaarsen Mar 3, 2026
cb08c2f
Default to text if the model was saved without modality_config
tomaarsen Mar 3, 2026
bd295a5
Properly load and save similarity_fn_name for SparseEncoder
tomaarsen Mar 3, 2026
a8c6348
Patch Transformer test
tomaarsen Mar 3, 2026
064f685
Reintroduce prompts to SparseEncoder
tomaarsen Mar 4, 2026
ff53a2b
Rename 'models' directories to 'modules'
tomaarsen Mar 4, 2026
3286d0f
Turn unnecessary multi-lines into single-line
tomaarsen Mar 4, 2026
f2ec816
Use full imports under sentence_transformers instead of modules short…
tomaarsen Mar 4, 2026
bbacdfa
Simplify deprecated imports for Router/Asym
tomaarsen Mar 4, 2026
8bdc71c
Move 'models' tests to 'modules' as well
tomaarsen Mar 4, 2026
b9c412a
Patch processing calls for transformers v4 and v5
tomaarsen Mar 4, 2026
b44024d
Use _get_default_modality_config for compat. with MLMTransformer/CLIP…
tomaarsen Mar 4, 2026
f788bf4
Reintroduce multimodality support for Router
tomaarsen Mar 4, 2026
e9132be
Refactor and clean up the InputFormatter
tomaarsen Mar 5, 2026
61ee704
Considerable mostly-stylistic refactoring of Transformer and related
tomaarsen Mar 5, 2026
89278b3
Reorder Transformer methods
tomaarsen Mar 5, 2026
62d79bd
Create .git-blame-ignore-revs with reordering PR
tomaarsen Mar 5, 2026
e6d1a7d
Add considerable transformers tests; use pytest mocking
tomaarsen Mar 5, 2026
b19a144
Rerun tiny-model updating script with Transformers v5.3.0
tomaarsen Mar 5, 2026
22a7ca2
Avoid same object reference for model/tokenizer/config kwargs due to …
tomaarsen Mar 5, 2026
a94f12c
Fix prompt_length cache keys
tomaarsen Mar 6, 2026
83c28d0
Expand on test suite to test more edge cases
tomaarsen Mar 6, 2026
88d57cf
Add processing_kwargs to override kwargs passed to processor/apply_ch…
tomaarsen Mar 6, 2026
701e23b
Reorder the args in __init__, replace cache_dir
tomaarsen Mar 6, 2026
c3de8d5
Slightly refactor Transformer further
tomaarsen Mar 6, 2026
39da888
Throw error if incompatible modality is provided
tomaarsen Mar 6, 2026
3821c9c
Remove TODO from _get_model_type
tomaarsen Mar 6, 2026
9a5b43e
Add extra case for do_lower_case in Transformers v4
tomaarsen Mar 6, 2026
499d01b
Rename and deprecate tokenizer_kwargs in favor of processor_kwargs
tomaarsen Mar 6, 2026
1761239
Refactor and clean up SentenceTransformer/SparseEncoder
tomaarsen Mar 9, 2026
d7df31c
Refactor pair input processing, bring full multimodal to CrossEncoder
tomaarsen Mar 10, 2026
16fd10c
Rename SAE preprocess to prepare to avoid confusion
tomaarsen Mar 10, 2026
aa98660
Patch sequence classification/text generation
tomaarsen Mar 10, 2026
60a79e9
Implement BaseModel.supports(modality)
tomaarsen Mar 10, 2026
45daa31
Tiny cleanup on BaseModel; add tests
tomaarsen Mar 10, 2026
7ca5846
Use torch.device in type hint output
tomaarsen Mar 10, 2026
a007c9a
Note down some TODOs for later
tomaarsen Mar 10, 2026
134c8a7
Move prompts functionality to BaseModel
tomaarsen Mar 10, 2026
6b320ab
Add prompts/prompt_name BaseTrainer
tomaarsen Mar 12, 2026
b70bd99
Add any-to-any transformer_task with edge cases and tests
tomaarsen Mar 12, 2026
1ae9826
Split modality_utils.py into modality_types.py and modality.py
tomaarsen Mar 13, 2026
a4318ac
Extensive TitleCase -> snake_case file renaming + backwards compat.
tomaarsen Mar 13, 2026
0db9a35
Rename example/test files to snake_case and replace dashes with under…
tomaarsen Mar 13, 2026
a010985
Update .git-blame-ignore-revs to include recent renaming and restruct…
tomaarsen Mar 13, 2026
b72d6bf
Patch trainer tests following recent trainer changes
tomaarsen Mar 13, 2026
6e01cce
Merge branch 'main' into refactor/multimodal
tomaarsen Mar 13, 2026
838da4d
any-to-any is transformers v5+ only
tomaarsen Mar 13, 2026
23cffe4
Upgrade ruff in .pre-commit-config
tomaarsen Mar 13, 2026
9c58fbf
Document CrossEncoder.predict activation_fn breaking change in migrat…
tomaarsen Mar 13, 2026
dc6f63a
Document CrossEncoder.push_to_hub tags breaking change in migration g…
tomaarsen Mar 13, 2026
d5550fc
Check feature-extraction model output shape
tomaarsen Mar 13, 2026
9492911
Improve modality error messages and use "+" separator for serialization
tomaarsen Mar 13, 2026
1f7cdd4
Add deprecation warnings for old import paths
tomaarsen Mar 13, 2026
9470b09
Fix small test issues due to renames/updated error text
tomaarsen Mar 13, 2026
4946781
Import not from file, but from directory in docs/examples
tomaarsen Mar 13, 2026
93273c4
More informative error for deprecated dict-style Router/Asym input
tomaarsen Mar 16, 2026
29dcd28
Add automatic flattening if feature-extraction, torch, FA, new transf…
tomaarsen Mar 17, 2026
1568d1f
Cast Column input to encode/predict to list: considerably speedup
tomaarsen Mar 17, 2026
0ccfa2a
Add balanced input sorting for flattened inputs to reduce peak memory
tomaarsen Mar 17, 2026
a81f883
Fix test signatures to match refactored modality inference and forwar…
tomaarsen Mar 17, 2026
22c5079
Rephrase warning, use warning_once via transformers
tomaarsen Mar 17, 2026
932375f
Skip flattened-input pooling tests on transformers <v5
tomaarsen Mar 17, 2026
09337b6
Unpack lazy_import_flash_attention with *_ for forward compatibility
tomaarsen Mar 17, 2026
f3c3e12
Fix upcoming release version
tomaarsen Mar 17, 2026
88c55ec
Remove TODO, edge case dict is fine
tomaarsen Mar 17, 2026
ec3423f
Raise on bare {"array": ...} dicts, resolve infer_modality TODOs
tomaarsen Mar 17, 2026
7ff8cbd
Fix flaky test by accepting either task key in error message regex
tomaarsen Mar 17, 2026
c8b4409
Sort config keys alphabetically when saving model config
tomaarsen Mar 17, 2026
8b99e85
Remove unnecessary TODO, checked and no regression
tomaarsen Mar 17, 2026
445122a
Add some TODOs
tomaarsen Mar 17, 2026
e46003a
Improve push_to_hub PR descriptions with model-specific usage tips
tomaarsen Mar 17, 2026
6d45e81
Rename model doc pages to consistent model.md and add redirects
tomaarsen Mar 17, 2026
08edca4
Align export backend PR descriptions with push_to_hub style
tomaarsen Mar 17, 2026
dbb7970
Add type annotations for model, args, and data_collator in BaseTrainer
tomaarsen Mar 17, 2026
457c0f2
Remove stale TODO
tomaarsen Mar 17, 2026
7199852
Rename load_data_collator to get_data_collator for consistency
tomaarsen Mar 17, 2026
6abf209
Add pixel_values_videos (video) and input_values (audio) support to c…
tomaarsen Mar 17, 2026
096f7a5
Remove stale TODO, we're not moving to only transformers v5 yet
tomaarsen Mar 17, 2026
ab16218
Rename SentenceEvaluator to BaseEvaluator for naming consistency
tomaarsen Mar 17, 2026
a447142
Clean up BaseEvaluator
tomaarsen Mar 17, 2026
db5f48c
Return earlier on processing empty list
tomaarsen Mar 18, 2026
bf7a317
Add Router __repr__ showing sub-module structure and config
tomaarsen Mar 18, 2026
9a4f866
Improve docstrings for Transformer, BaseModel, and subclasses
tomaarsen Mar 18, 2026
60d9a91
Batch CrossEncoderRerankingEvaluator predictions
tomaarsen Mar 18, 2026
4aa0161
Update imports to use base.evaluation, but BC preserved
tomaarsen Mar 18, 2026
15f8693
Add multimodal support to model cards and enforce left padding for ca…
tomaarsen Mar 19, 2026
8472cc9
Rename any-to-any with image-text-to-text
tomaarsen Mar 19, 2026
1518176
Revert "Rename any-to-any with image-text-to-text"
tomaarsen Mar 20, 2026
3e04f60
Patch some mixed batch multimodal input processing issues
tomaarsen Mar 24, 2026
f54bc0b
Add `unpad_inputs` parameter to allow disabling flattened inputs
tomaarsen Mar 24, 2026
4d68d8d
Save inferred message_format instead of "auto" in Transformer config
tomaarsen Mar 24, 2026
8f42103
Support list-based method_output_name (e.g. ["hidden_states", -1]) in…
tomaarsen Mar 24, 2026
969fabd
Add unpad_inputs property to Transformer for disabling padding-free i…
tomaarsen Mar 24, 2026
b26ff58
Early return if inputs is empty in Transformer.preprocess
tomaarsen Mar 24, 2026
7c858a6
Add TODO for v6: use float scores in CE.rank eventually
tomaarsen Mar 25, 2026
9592148
Also set the processor.tokenizer.padding_side = "left" for generative…
tomaarsen Mar 25, 2026
76b834b
Fix text pairs losing query/document roles in mixed-modality batches
tomaarsen Mar 25, 2026
8d2502c
Fix CachedMNRL minibatching for mixed-modality VLM inputs
tomaarsen Mar 25, 2026
b27f0a2
Add video modality support and move IR model card logic to base
tomaarsen Mar 25, 2026
54502b3
Fix model card tests for BertConfig class-level hidden_size default
tomaarsen Mar 25, 2026
2383912
Add some tests to make sure that unpad_inputs is saved as expected
tomaarsen Mar 25, 2026
4dba7b5
Proper support for VideoDecoder/AudioDecoder, also in types
tomaarsen Mar 25, 2026
6ae04a8
Import Image as PILImage for clarity
tomaarsen Mar 25, 2026
dda3cf9
Also rename Image -> PILImage in tests
tomaarsen Mar 25, 2026
7ac284d
Move Dense to base modules
tomaarsen Mar 26, 2026
f0aa6b7
Clean up Dense module docstring and reduce boilerplate
tomaarsen Mar 26, 2026
36a4d4e
Add ProcessingKwargs TypedDict and warn on unknown processing_kwargs …
tomaarsen Mar 26, 2026
0e4ba29
Add backwards-compatible deprecation for CrossEncoder positional init…
tomaarsen Mar 26, 2026
2109cdb
Normalize log messages across model loading and inference
tomaarsen Mar 26, 2026
119a8ce
Preserve user dict ordering in multimodal InputFormatter methods
tomaarsen Mar 26, 2026
7f693db
Replace user-facing TODO comments with NOTE in PR number instructions
tomaarsen Mar 26, 2026
880de55
Add transformers v5.4+ processor_kwargs compatibility in apply_chat_t…
tomaarsen Mar 26, 2026
f64df3b
Restrict input flattening to text-only inputs for multimodal model co…
tomaarsen Mar 26, 2026
3e1f604
Remove old TODO
tomaarsen Mar 26, 2026
23b0632
Update to transformers v5.4.0
tomaarsen Mar 27, 2026
6be6435
Standardize CrossEncoder scores to [batch_size, num_labels] output shape
tomaarsen Mar 27, 2026
86e0a21
Move test files to mirror source directory structure
tomaarsen Mar 27, 2026
9ecb9b3
Add "move tests file" commit to .git-blame-ignore-revs
tomaarsen Mar 27, 2026
e8fbc4f
Clean up CE tests slightly
tomaarsen Mar 27, 2026
3a3cfd2
Rename CausalScoreHead to LogitScore
tomaarsen Mar 27, 2026
c382cf5
Remove centralized modules.py; import from model-specific module paths
tomaarsen Mar 27, 2026
f21b3f6
Remove now-moot TODO, export ModelCardData for the 3 archetypes
tomaarsen Mar 27, 2026
8f7cbb1
Add document screenshot training script
tomaarsen Mar 27, 2026
602ea0c
Remove SimilarityFunction re-export wrapper: import directly from uti…
tomaarsen Mar 27, 2026
bc633f2
Drop unsupported new config params when loading old custom modules
tomaarsen Mar 27, 2026
333feff
Finalize the training_document_screenshot_embedding script
tomaarsen Mar 30, 2026
4cc5603
Cache to_dict() result for to_yaml() reuse in model card generation
tomaarsen Mar 30, 2026
e794263
Consider return_dict as a default model_forward_param
tomaarsen Mar 30, 2026
2ad62f6
Optimize cached losses: skip backward for frozen Router routes
tomaarsen Mar 30, 2026
eaa2481
Suppress MLMTransformer deprecation warning when loading saved models
tomaarsen Mar 30, 2026
e60ec08
Use load_file_path util in SparseStaticEmbedding.from_json
tomaarsen Mar 30, 2026
03be214
Remove RegNet from xfail architectures: input_modalities now correct
tomaarsen Mar 30, 2026
78fc749
Docs: integrate multimodality and CrossEncoder modularity into docs
tomaarsen Apr 1, 2026
a1a6cd5
Fix inputs potentially becoming multiple feature sets in Trainer
tomaarsen Apr 1, 2026
1187558
Fix passing model_init with a loss dictionary
tomaarsen Apr 1, 2026
7cd3789
Reformat message_format away into modality_config -> message -> format
tomaarsen Apr 1, 2026
ab08850
Ensure we use a modern datasets in the transformers <5.0.0 tests
tomaarsen Apr 1, 2026
78659a9
Deprecate CLIPModel consistently with MLMTransformer
tomaarsen Apr 1, 2026
a9b5d1f
Update sbert.net links to relative links where useful
tomaarsen Apr 1, 2026
a26df49
Update some docs examples to reflect current save output
tomaarsen Apr 1, 2026
2f9db0e
Fix mutual infinite recursion between InputModule.preprocess() and to…
tomaarsen Apr 1, 2026
15195f0
link module class references in docs to their API docs
tomaarsen Apr 1, 2026
cfc3ed0
Fix issues in docs snippets
tomaarsen Apr 1, 2026
84790d6
Remove moot TODO
tomaarsen Apr 1, 2026
4145c00
Install model2vec with the distill extra
tomaarsen Apr 1, 2026
e19192c
Fix deprecation warning test (it's a logger.warning_once now)
tomaarsen Apr 1, 2026
f36f7c2
Update docs model names to include Hugging Face org prefix
tomaarsen Apr 1, 2026
f526c39
Replace mm_token_type_ids with precomputed per-sample media counts fo…
tomaarsen Apr 1, 2026
4dea600
Cleanup comments
tomaarsen Apr 1, 2026
87b5936
Replace soundfile with torchcodec AudioEncoder for audio file writing
tomaarsen Apr 1, 2026
7ee7440
Add install hints for missing multimodal dependencies
tomaarsen Apr 1, 2026
6f3a162
Add multimodal install extras (image/audio/video) and document depend…
tomaarsen Apr 1, 2026
944872a
Replace torchcodec encoders with torchaudio/av and make torchcodec an…
tomaarsen Apr 2, 2026
8f1bf91
Add min-version tests and backwards-compat guards for older transform…
tomaarsen Apr 2, 2026
0075552
Install libraries in min-versions CI for av build
tomaarsen Apr 2, 2026
ebbbbe8
Fix torchcodec test and empty prompts parsing in training args
tomaarsen Apr 2, 2026
b1fb8e0
Exclude kenlm on Python 3.13 for older transformers in CI
tomaarsen Apr 2, 2026
4e51bf8
Allow plain string prompts again
tomaarsen Apr 2, 2026
4829765
Fix torchcodec tests
tomaarsen Apr 2, 2026
30207c6
Let's try a more reasonable `av`
tomaarsen Apr 2, 2026
4bd1281
Try to patch min-versions: split runtime and dev tool installs
tomaarsen Apr 2, 2026
25e11c6
Set datasets>=2.0.0 minimum to fix lowest-resolution CI
tomaarsen Apr 2, 2026
030dd3b
Using a slightly more modern scipy version for min-versions
tomaarsen Apr 2, 2026
3245c2f
Use more modern datasets for min-versions
tomaarsen Apr 2, 2026
c656b45
Also try-except ImportError wrap CrossEncoder for datasets.Column
tomaarsen Apr 2, 2026
e0bf4c2
Merge branch 'main' of into refactor/multimodal
tomaarsen Apr 2, 2026
5325b5b
Improve compatibility with older transformers and datasets versions
tomaarsen Apr 2, 2026
92b377d
Attempt to fix silent Windows Python 3.13 crash
tomaarsen Apr 2, 2026
ecbac76
Patch voxtral_realtime
tomaarsen Apr 2, 2026
10b2c25
Merge branch 'main' into refactor/multimodal
tomaarsen Apr 2, 2026
3818aba
Exclude kenlm and pyctcdecode on Python 3.13 for both transformers ve…
tomaarsen Apr 2, 2026
96e6039
Use bash shell for Python 3.13 file exclusion
tomaarsen Apr 2, 2026
4949768
Allow disabling saved prompts by passing empty strings
tomaarsen Apr 3, 2026
3880118
Fix edge cases and improve robustness across base module
tomaarsen Apr 3, 2026
63d8647
Also improve cross_encoder code quality/edge cases
tomaarsen Apr 3, 2026
97d995e
And improve sentence_transformer code quality/edge cases
tomaarsen Apr 3, 2026
f8f0654
And lastly improve sparsE_encoder code quality/edge cases
tomaarsen Apr 3, 2026
54939d8
Rename "document screenshot embedding" to vdr
tomaarsen Apr 3, 2026
85d562a
Move model-type-specific model card defaults to subclasses
tomaarsen Apr 3, 2026
4119b77
Add extra tests for BaseModel, BaseDataCollator, Router, and Transformer
tomaarsen Apr 3, 2026
7553f85
Cast non-input modules to match first module's dtype on load
tomaarsen Apr 3, 2026
e42a62b
Restore backwards compatibility for Router dict-style input
tomaarsen Apr 3, 2026
6432cb2
Mention encode_query/encode_document a bit more in the docs
tomaarsen Apr 3, 2026
af7f520
Add Router-based multimodal documentation to training overview
tomaarsen Apr 3, 2026
b61b502
Disallow empty modules list in BaseModel with a ValueError
tomaarsen Apr 3, 2026
1c6d463
add typos check (#8)
Samoed Apr 3, 2026
40724c1
Add Flash Attention documentation to SentenceTransformer efficiency docs
tomaarsen Apr 3, 2026
c6f1a1e
Add 2 TODOs for small feature requests
tomaarsen Apr 3, 2026
9bac152
Fix GISTEmbedLoss trying to move modality string to device
tomaarsen Apr 7, 2026
e4e57e5
Add training/evaluation duration tracking to model cards
tomaarsen Apr 7, 2026
b4229c2
Default to last token pooling for CausalLM models
tomaarsen Apr 7, 2026
3eb3cbf
Add tests for default CausalLM last-token pooling behavior
tomaarsen Apr 7, 2026
3d667c2
Update pretrained tests to bfloat16/sdpa
tomaarsen Apr 7, 2026
28f3f94
Update docs to use official model namespaces instead of my own forks
tomaarsen Apr 8, 2026
f6edccd
Fix empty batch test to try and pass minimum-version tests
tomaarsen Apr 8, 2026
5d0156a
Don't call super()._load_default_modules, but self._load_default_modu…
tomaarsen Apr 8, 2026
4cf749e
Ensure output_dim exists when loading SparseEncoder from ST model
tomaarsen Apr 8, 2026
75343f2
Prevent multi-process SparseEncoder from eating errors
tomaarsen Apr 8, 2026
e5337c3
Fix various minor issues
tomaarsen Apr 8, 2026
43d374d
Remove dead code in reranking
tomaarsen Apr 8, 2026
27648d4
Throw warning if multiple embedding dimensions in Router
tomaarsen Apr 8, 2026
54d40fb
Add SparseEncoder prompts docs
tomaarsen Apr 8, 2026
659148c
Fix minor issues in base evaluator and router
tomaarsen Apr 8, 2026
2ece807
More minor fixes throughout the project
tomaarsen Apr 8, 2026
4a82a84
Return first embedding_dimension in Router for BC
tomaarsen Apr 8, 2026
d0dcafd
Fix CrossEncoder.predict with batch_size=1 when scores lack trailing dim
tomaarsen Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Reorder Transformer class methods into logical groups
89278b37fa5fb5d63541a7b584116665b0f1c29f
# Extensive TitleCase -> snake_case file renaming + backwards compat.
a4318ac5b39e043eda56e40cbef637882f8e4030
# Rename example/test files to snake_case and replace dashes with underscores
0db9a35d3d4b017aa79dfb7e5c6db78592d4ae23
# Move test files to mirror source directory structure
86e0a21228683fd7feac002cad5d7ff5536d3f2e
71 changes: 71 additions & 0 deletions .github/workflows/min-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Minimum version tests

on:
push:
branches:
- main
- "*-release"
pull_request:
branches:
- main
- "*-release"
paths:
- "pyproject.toml"
- "sentence_transformers/**"
- ".github/workflows/min-versions.yml"
workflow_dispatch:

env:
TRANSFORMERS_IS_CI: 1
HF_HUB_DISABLE_PROGRESS_BARS: 1

jobs:
test_min_versions:
name: Test minimum dependency versions
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift

- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Setup Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6

- name: Install FFmpeg libraries (needed to build av)
run: sudo apt-get update && sudo apt-get install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libswresample-dev

- name: Install with minimum versions
# Runtime deps at lowest resolution & dev tools at normal resolution
# av>=12 because av==9.2.0 (from transformers[video]) fails to compile with modern Cython
# scipy>=1.7.2 because older scipy has no wheels for Python 3.10+ and fails to build from source
# datasets>=2.14.7 because older datasets uses pyarrow's removed PyExtensionType
run: |
uv pip install '.[train]' 'transformers[vision,audio,video]' 'av>=12.0.0' 'scipy>=1.7.2' 'datasets>=2.14.7' --resolution lowest-direct --system
uv pip install pytest pytest-cov pytest-env pytest-subtests pytest-xdist peft --system

- name: Show installed versions
run: uv pip list --system | grep -iE 'transformers|huggingface|torch|numpy|scikit|scipy|typing.ext|tqdm|accelerate'

- name: Run unit tests
run: python -m pytest --durations 20 -sv tests/
15 changes: 13 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,24 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6

# kenlm doesn't compile on Python 3.13, and pyctcdecode pins numpy<2.0.0
# which conflicts with the rest of the stack. Exclude both on Python 3.13.
- name: Create excludes file for packages without Python 3.13 support
shell: bash
run: |
if [ "${{ matrix.python-version }}" = "3.13" ]; then
echo -e "kenlm\npyctcdecode" > excludes.txt
else
touch excludes.txt
fi

- name: Install dependencies (transformers < 5.0.0)
if: ${{ matrix.transformers-version == '<5.0.0' }}
run: uv pip install '.[train, onnx, openvino, dev]' 'transformers<5.0.0' 'datasets>=3.3.0' --system
run: uv pip install '.[train, onnx, openvino, dev]' 'transformers<5.0.0' 'accelerate>=1.13.0' 'datasets>=3.3.0' --excludes excludes.txt --system

- name: Install dependencies (transformers >= 5.0.0)
if: ${{ matrix.transformers-version == '>=5.0.0' }}
run: uv pip install '.[train, dev]' 'transformers>=5.0.0' --system
run: uv pip install '.[train, dev]' 'transformers>=5.0.0' 'accelerate>=1.13.0' --excludes excludes.txt --system

- name: Install model2vec
run: uv pip install model2vec[distill] --system
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
__pycache__

# Docs
/docs/_build/
Expand Down
21 changes: 15 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.5
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.6
hooks:
# Run the linter.
- id: ruff-check
args: [ --fix, --show-fixes ]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/crate-ci/typos
rev: v1.45.0
hooks:
- id: typos
args: ["--diff", "--force-exclude"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ First download a pretrained embedding a.k.a. Sentence Transformer model.
```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("all-MiniLM-L6-v2")
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
```

Then provide some texts to the model.
Expand Down Expand Up @@ -112,7 +112,7 @@ print(scores)
# => [8.607139 5.506266 6.352977]
```

And we're good to go. You can also use [`model.rank`](https://sbert.net/docs/package_reference/cross_encoder/cross_encoder.html#sentence_transformers.cross_encoder.CrossEncoder.rank) to avoid having to perform the reranking manually:
And we're good to go. You can also use [`model.rank`](https://sbert.net/docs/package_reference/cross_encoder/cross_encoder.html#sentence_transformers.cross_encoder.model.CrossEncoder.rank) to avoid having to perform the reranking manually:

```python
# 2b. Rank a list of passages for a query
Expand Down
14 changes: 13 additions & 1 deletion docs/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Redirect 301 /docs/package_reference/cross_encoder.html /docs/package_reference/
Redirect 301 /docs/package_reference/datasets.html /docs/package_reference/sentence_transformer/datasets.html
Redirect 301 /docs/package_reference/evaluation.html /docs/package_reference/sentence_transformer/evaluation.html
Redirect 301 /docs/package_reference/losses.html /docs/package_reference/sentence_transformer/losses.html
Redirect 301 /docs/package_reference/models.html /docs/package_reference/sentence_transformer/models.html
Redirect 301 /docs/package_reference/models.html /docs/package_reference/sentence_transformer/modules.html
Redirect 301 /docs/package_reference/quantization.html /docs/package_reference/sentence_transformer/quantization.html
Redirect 301 /docs/package_reference/SentenceTransformer.html /docs/package_reference/sentence_transformer/SentenceTransformer.html

Expand Down Expand Up @@ -71,6 +71,18 @@ Redirect 301 /examples/unsupervised_learning/README.html /examples/sentence_tran
Redirect 301 /examples/unsupervised_learning/SimCSE/README.html /examples/sentence_transformer/unsupervised_learning/SimCSE/README.html
Redirect 301 /examples/unsupervised_learning/TSDAE/README.html /examples/sentence_transformer/unsupervised_learning/TSDAE/README.html

# Moved API Reference pages for v5.3.0
Redirect 301 /docs/package_reference/sentence_transformer/quantization.html /docs/package_reference/util/quantization.html
Redirect 301 /docs/package_reference/util.html /docs/package_reference/util/index.html

# Moved API Reference pages for v5.4.0, the multimodality refactor
Redirect 301 /docs/package_reference/sentence_transformer/models.html /docs/package_reference/sentence_transformer/modules.html
Redirect 301 /docs/package_reference/cross_encoder/models.html /docs/package_reference/cross_encoder/modules.html
Redirect 301 /docs/package_reference/sparse_encoder/models.html /docs/package_reference/sparse_encoder/modules.html
Redirect 301 /docs/package_reference/sentence_transformer/SentenceTransformer.html /docs/package_reference/sentence_transformer/model.html
Redirect 301 /docs/package_reference/sparse_encoder/SparseEncoder.html /docs/package_reference/sparse_encoder/model.html
Redirect 301 /docs/package_reference/cross_encoder/cross_encoder.html /docs/package_reference/cross_encoder/model.html

# Redirect to index.html when request file does not exist
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
Expand Down
Loading
Loading