Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/huggingface/sentence-transformers
/ functions
Functions
4,575 in github.com/huggingface/sentence-transformers
⨍
Functions
4,575
◇
Types & classes
516
↳
Endpoints
81
Function
test_pretrained_colpali_multimodal
End-to-end image path. The checkpoint loads in bfloat16, so the assertions stay structural.
tests/multi_vector_encoder/test_pretrained.py:238
Function
test_pretrained_colqwen2_hf_for_retrieval
Auto-recognition of transformers-native ``*ForRetrieval`` checkpoints, whose head projects and normalises internally: the pipeline must be ``Trans
tests/multi_vector_encoder/test_pretrained.py:282
Function
test_pretrained_image_document_maxsim
Cross-library parity for image documents, covering every multimodal load path.
tests/multi_vector_encoder/test_pretrained.py:187
Function
test_pretrained_legacy_save_seeds_punctuation_skiplist
Legacy saves still get the punctuation skiplist after the bare-HF default flipped to empty.
tests/multi_vector_encoder/test_pretrained.py:220
Function
test_pretrained_model_bf16_sdpa
(model_name: str, expected_config: tuple[list[float], dict[str, Any]])
tests/sentence_transformer/test_pretrained.py:161
Function
test_pretrained_model_bf16_sdpa
(model_name: str, expected_config: tuple[list[float], dict[str, Any]])
tests/cross_encoder/test_pretrained.py:151
Function
test_pretrained_model_bf16_sdpa
( model_name: str, expected_config: tuple[list[float], dict[str, Any]] | tuple[list[float], dict[str, Any]
tests/sparse_encoder/test_pretrained.py:123
Function
test_pretrained_multi_vector_maxsim
(model_name: str, expected_score: list[float])
tests/multi_vector_encoder/test_pretrained.py:142
Function
test_pretrained_prompt_prefix_stays_one_token
The checkpoints insert the prefix as a token while we prepend it as text, which only agree while the prefix tokenizes to one piece (with or withou
tests/multi_vector_encoder/test_pretrained.py:157
Function
test_pretrained_stsb
(stsb_dataset_dict: DatasetDict)
tests/cross_encoder/test_train_stsb.py:41
Function
test_primary_metric_is_prefixed_and_present_with_name
With a name, the returned metric keys are prefixed with it, so primary_metric must be updated to the prefixed key; otherwise the documented ``
tests/sparse_encoder/test_reciprocal_rank_fusion.py:24
Function
test_primary_metric_is_present_without_name
Without a name the metric keys are unprefixed, and primary_metric stays ``ndcg@10`` and is still present in the results.
tests/sparse_encoder/test_reciprocal_rank_fusion.py:41
Function
test_private_load_with_module_classes_loads_without_trust_remote_code
A module class outside Sentence Transformers needs ``trust_remote_code=True``, which also permits remote code for the backbone. Supplying the clas
tests/base/test_model.py:2064
Function
test_probability_labels_match_cross_entropy
( model: SentenceTransformer, features: list[dict[str, torch.Tensor]] )
tests/sentence_transformer/losses/test_softmax.py:46
Method
test_probe_covers_structured_message_format
Structured-format processors probe through typed content items rather than plain strings.
tests/base/test_modality.py:1627
Method
test_probe_is_rendered_lazily
A template assigned after construction must still be picked up.
tests/base/test_modality.py:1659
Method
test_probe_reruns_after_a_named_template_is_edited_in_place
Fixing one entry of a named-template dict edits it in place, and must not hit a stale verdict.
tests/base/test_modality.py:1675
Method
test_probe_reruns_after_a_rejected_template_is_replaced
Replacing a rejected template is the documented remedy, so a stale verdict must not pin it.
tests/base/test_modality.py:1666
Function
test_probe_uses_the_configured_chat_template_kwargs
A model may select a named rerank template via processing kwargs, as Qwen3-VL-Reranker does. The probe must measure the selected template rather
tests/cross_encoder/test_model.py:1094
Method
test_probe_uses_the_render_kwargs
Kwargs can select a named template, so the probe must measure the one the render uses. Qwen3-VL-Reranker ships a ``reranker`` template next t
tests/base/test_modality.py:1639
Method
test_processing_kwargs_chat_template_passed_through
Instance ``processing_kwargs['chat_template']`` should reach ``apply_chat_template`` via preprocess.
tests/base/modules/test_transformer.py:1312
Method
test_processing_kwargs_default_empty
processing_kwargs should default to an empty dict when not provided.
tests/base/modules/test_transformer.py:235
Method
test_processing_kwargs_omitted_from_config_when_empty
Empty processing_kwargs should not appear in the saved config JSON.
tests/base/modules/test_transformer.py:1927
Method
test_processing_kwargs_save_load_roundtrip
processing_kwargs should be persisted to config JSON and restored on load.
tests/base/modules/test_transformer.py:1906
Method
test_processing_kwargs_stored
processing_kwargs passed to __init__ should be stored on the instance.
tests/base/modules/test_transformer.py:240
Method
test_processing_kwargs_unknown_keys_warning
Unknown top-level keys in processing_kwargs should emit a warning.
tests/base/modules/test_transformer.py:246
Method
test_processing_kwargs_valid_keys_no_warning
Valid processing_kwargs keys should not emit a warning.
tests/base/modules/test_transformer.py:252
Method
test_processor_generated_labels_are_discarded
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:546
Function
test_projection_autocast_preserves_teacher_precision
( word_embeddings_model: SentenceTransformer, dtype: torch.dtype )
tests/sentence_transformer/losses/test_embed_distill.py:291
Method
test_projection_dim_for_sentence_embedding
When module_output_name is 'sentence_embedding', projection_dim takes priority.
tests/base/modules/test_transformer.py:1165
Function
test_projection_dim_matches_teacher
projection_dim should produce a Linear that outputs teacher_dim.
tests/sentence_transformer/losses/test_embed_distill.py:115
Function
test_projection_layer_changes_during_training
The projection layer should receive gradients and update its weights.
tests/sentence_transformer/losses/test_embed_distill.py:93
Function
test_projection_model_dtypes
The projection is created in float32, so a low-precision model must not crash in it.
tests/sentence_transformer/losses/test_embed_distill.py:270
Function
test_prompt_combinations
Test various prompt configurations.
tests/util/test_hard_negatives.py:1569
Method
test_prompt_length_cache_distinguishes_kwarg_keys
Different kwarg keys with the same values should produce separate cache entries.
tests/base/modules/test_transformer.py:1194
Method
test_prompt_length_cached
Second call with the same prompt should use the cache.
tests/base/modules/test_transformer.py:1185
Function
test_prompt_length_calculation
( stsb_bert_tiny_model: SentenceTransformer, has_bos_token: bool, has_eos_token: bool )
tests/sentence_transformer/test_model.py:456
Method
test_prompt_length_excludes_special_tokens
Prompt length should exclude trailing special tokens like [SEP].
tests/base/modules/test_transformer.py:1202
Function
test_prompt_length_ignores_query_expansion
The prompt length feeds prompt-aware pooling and must report the prompt's own token count, not the expansion-padded width.
tests/multi_vector_encoder/test_model.py:1878
Function
test_prompt_output_value_None
(stsb_bert_tiny_model)
tests/sentence_transformer/test_model.py:432
Function
test_prompts
(stsb_bert_tiny_model: SentenceTransformer, caplog: pytest.LogCaptureFixture)
tests/sentence_transformer/test_model.py:359
Function
test_prompts
(splade_bert_tiny_model: SparseEncoder, caplog: pytest.LogCaptureFixture)
tests/sparse_encoder/test_model.py:736
Function
test_prompts
Test query_prompt and corpus_prompt parameters.
tests/util/test_hard_negatives.py:415
Function
test_proportional_no_duplicates
( dummy_duplicates_dataset: Dataset, drop_last: bool, precompute_hashes: bool )
tests/base/samplers/test_no_duplicates_batch_sampler.py:148
Function
test_push_from_checkpoint_copies_full_layout
(static_embedding_model: SentenceTransformer, tmp_path: Path)
tests/base/test_trainer.py:54
Function
test_push_from_checkpoint_skips_when_end_strategy
( static_embedding_model: SentenceTransformer, tmp_path: Path )
tests/base/test_trainer.py:112
Function
test_push_to_hub
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFix
tests/sentence_transformer/test_model.py:121
Function
test_push_to_hub
( reranker_bert_tiny_model: CrossEncoder, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixtur
tests/cross_encoder/test_model.py:537
Function
test_push_to_hub_commit_message_includes_backend
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:875
Function
test_push_to_hub_create_branch_on_revision
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:885
Function
test_push_to_hub_create_pr_commit_description_cross_encoder
( reranker_bert_tiny_model: CrossEncoder, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:829
Function
test_push_to_hub_create_pr_commit_description_sentence_transformer
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:808
Function
test_push_to_hub_create_pr_commit_description_sparse_encoder
( splade_bert_tiny_model: SparseEncoder, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:847
Function
test_push_to_hub_no_commit_description_without_create_pr
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:865
Function
test_push_to_hub_sparse_encoder
(splade_bert_tiny_model: SparseEncoder, monkeypatch: pytest.MonkeyPatch)
tests/base/test_model.py:789
Function
test_pylate_marked_conversion_defaults_punctuation_skiplist
A PyLate-marked SentenceTransformer-format save without an explicit ``skiplist_words`` gets PyLate's punctuation default on conversion, matching t
tests/multi_vector_encoder/test_model.py:971
Function
test_pylate_shape_save_round_trips_to_new_query_expansion
Save a natively-constructed MVE, rewrite ``config_sentence_transformers.json`` from the new ``query_expansion`` dict shape into the legacy PyLate
tests/multi_vector_encoder/test_model.py:1332
Function
test_pytorch_cos_sim
Tests the correct computation of pytorch_cos_sim
tests/util/test_similarity.py:29
Function
test_qdrant_batch_of_queries
A batch is searched once per query, each with only the tokens of that query.
tests/sparse_encoder/test_search_engines.py:143
Function
test_qdrant_rejects_3d_query_embeddings
A 3D tensor, like two stacked batches, must fail loudly rather than search with row ids as token ids.
tests/sparse_encoder/test_search_engines.py:166
Function
test_qdrant_single_query_embedding
Encoding a single query gives a 1-dimensional tensor, whose size(0) is the vocabulary.
tests/sparse_encoder/test_search_engines.py:131
Function
test_qdrant_single_query_searches_same_vector_as_batch_of_one
The promoted 1-dimensional tensor must search for the same vector as an explicit batch of one.
tests/sparse_encoder/test_search_engines.py:175
Function
test_qdrant_uploads_sparse_values
(stub_qdrant_module, dtype: torch.dtype)
tests/sparse_encoder/test_search_engines.py:155
Function
test_quantize_bfloat16_tensors
(precision: str, input_type: str)
tests/util/test_quantization.py:671
Function
test_quantize_clips_out_of_range_values
Values outside the calibration range must saturate, not wrap around, on cast. Without clipping, a value that should quantize above 255 silently w
tests/util/test_quantization.py:103
Function
test_quantize_empty_list_returns_empty_list
An empty input list (e.g. encode() of zero texts) must return an empty list, not IndexError.
tests/util/test_quantization.py:201
Function
test_quantize_multi_vector_calibrates_once
Ragged documents share one calibration scan, regardless of the number of documents.
tests/util/test_quantization.py:210
Function
test_quantize_multi_vector_handles_empty_matrices
A (0, dim) matrix (e.g. a fully-masked multi-vector document) must quantize to the correctly-shaped empty output instead of crashing packbits / ca
tests/util/test_quantization.py:180
Function
test_query_expansion_records_per_position_mask
Preprocess records WHICH positions hold expansion tokens as a ``(B, T)`` mask (not a per-batch bool), and the scoring mask force-includes exactly
tests/multi_vector_encoder/test_model.py:1192
Function
test_query_expansion_rejects_count_key
()
tests/multi_vector_encoder/test_model.py:148
Function
test_query_expansion_requires_length
()
tests/multi_vector_encoder/test_model.py:137
Function
test_query_expansion_requires_mask_or_eos_token
()
tests/multi_vector_encoder/test_model.py:158
Function
test_query_expansion_setter_validates_post_init
()
tests/multi_vector_encoder/test_model.py:261
Function
test_query_expansion_strategy_invalid_value_raises
()
tests/multi_vector_encoder/test_model.py:121
Function
test_query_expansion_token_not_in_vocab_raises
()
tests/multi_vector_encoder/test_model.py:181
Function
test_query_expansion_unknown_key_raises
()
tests/multi_vector_encoder/test_model.py:129
Function
test_query_expansion_with_message_backbone_raises
Expansion on a chat-template (message) backbone would render queries through the template and truncate to the expansion length, collapsing differe
tests/multi_vector_encoder/test_model.py:1892
Function
test_query_expansion_without_mask_module_warns
Only MultiVectorMask puts the expansion tokens in the scoring mask: constructing a pipeline with query_expansion but no MultiVectorMask warns inst
tests/multi_vector_encoder/test_model.py:1232
Function
test_qwen3_reranker_formatted_pairs
Test Qwen3 Reranker with manually formatted query-document pairs.
tests/cross_encoder/test_model.py:1134
Function
test_qwen3_reranker_original_with_identity_activation
Test original Qwen3 Reranker with Identity activation function.
tests/cross_encoder/test_model.py:1199
Function
test_qwen3_reranker_original_without_prompt
Test original Qwen3 Reranker with Identity activation function.
tests/cross_encoder/test_model.py:1269
Function
test_qwen3_reranker_with_chat_template
Test Qwen3 Reranker with Chat template.
tests/cross_encoder/test_model.py:1162
Method
test_ragged_lists_raise
(self, documents: Dataset)
tests/util/test_dataset.py:44
Method
test_ragged_lists_unified_by_max_list_length
(self, documents: Dataset)
tests/util/test_dataset.py:49
Method
test_ragged_rows_allowed
(self, documents: Dataset)
tests/util/test_dataset.py:97
Function
test_raises_on_invalid_batch_size
(two_label_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:114
Function
test_raises_on_single_label
()
tests/base/samplers/test_group_by_label_batch_sampler.py:107
Method
test_raises_when_no_dimension_found
Should raise ValueError when no dimension attribute is found.
tests/base/modules/test_transformer.py:1157
Function
test_rand_context_mps
(rand_context_path: str)
tests/sentence_transformer/losses/test_cmnrl.py:177
Function
test_rand_context_stays_importable_from_this_module
RandContext (and the mini-batching helpers) historically lived in this module and are copied around the ecosystem, so the extraction to gradcache.
tests/sentence_transformer/losses/test_cmnrl.py:534
Function
test_rand_context_working
(use_rand_context: bool)
tests/sentence_transformer/losses/test_cmnrl.py:142
Function
test_range_max_larger_than_corpus_does_not_crash
Requesting more candidates than the corpus holds must not crash the default (non-FAISS) path. `torch.topk` cannot return more columns than the cor
tests/util/test_hard_negatives.py:1987
Function
test_range_min_above_faiss_capped_range_max
The FAISS GPU cap can push an auto-derived range_max below range_min, so the error mentions the cap.
tests/util/test_hard_negatives.py:1512
Function
test_range_min_must_be_below_range_max
A range_min at or above range_max leaves no candidate window at all.
tests/util/test_hard_negatives.py:1498
Function
test_range_min_must_be_non_negative
A negative range_min would silently slice the candidate window from the wrong end.
tests/util/test_hard_negatives.py:1483
Function
test_range_parameters
Test range_min and range_max parameters.
tests/util/test_hard_negatives.py:327
Method
test_ranges_cover_the_batch_exactly
(self)
tests/sentence_transformer/losses/test_gradcache.py:301
Function
test_rank
(return_documents: bool, reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:129
Function
test_rank_apply_softmax_deprecated
(reranker_bert_tiny_model: CrossEncoder, apply_softmax: bool, caplog)
tests/cross_encoder/test_model.py:179
Function
test_rank_convert_kwargs_deprecated
(reranker_bert_tiny_model: CrossEncoder, kwarg: str, caplog)
tests/cross_encoder/test_model.py:168
← previous
next →
3,801–3,900 of 4,575, ranked by callers