MCPcopy Create free account

hub / github.com/huggingface/sentence-transformers / functions

Functions4,575 in github.com/huggingface/sentence-transformers

Functiontest_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
Functiontest_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
Functiontest_pretrained_image_document_maxsim
Cross-library parity for image documents, covering every multimodal load path.
tests/multi_vector_encoder/test_pretrained.py:187
Functiontest_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
Functiontest_pretrained_model_bf16_sdpa
(model_name: str, expected_config: tuple[list[float], dict[str, Any]])
tests/sentence_transformer/test_pretrained.py:161
Functiontest_pretrained_model_bf16_sdpa
(model_name: str, expected_config: tuple[list[float], dict[str, Any]])
tests/cross_encoder/test_pretrained.py:151
Functiontest_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
Functiontest_pretrained_multi_vector_maxsim
(model_name: str, expected_score: list[float])
tests/multi_vector_encoder/test_pretrained.py:142
Functiontest_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
Functiontest_pretrained_stsb
(stsb_dataset_dict: DatasetDict)
tests/cross_encoder/test_train_stsb.py:41
Functiontest_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
Functiontest_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
Functiontest_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
Functiontest_probability_labels_match_cross_entropy
( model: SentenceTransformer, features: list[dict[str, torch.Tensor]] )
tests/sentence_transformer/losses/test_softmax.py:46
Methodtest_probe_covers_structured_message_format
Structured-format processors probe through typed content items rather than plain strings.
tests/base/test_modality.py:1627
Methodtest_probe_is_rendered_lazily
A template assigned after construction must still be picked up.
tests/base/test_modality.py:1659
Methodtest_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
Methodtest_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
Functiontest_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
Methodtest_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
Methodtest_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
Methodtest_processing_kwargs_default_empty
processing_kwargs should default to an empty dict when not provided.
tests/base/modules/test_transformer.py:235
Methodtest_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
Methodtest_processing_kwargs_save_load_roundtrip
processing_kwargs should be persisted to config JSON and restored on load.
tests/base/modules/test_transformer.py:1906
Methodtest_processing_kwargs_stored
processing_kwargs passed to __init__ should be stored on the instance.
tests/base/modules/test_transformer.py:240
Methodtest_processing_kwargs_unknown_keys_warning
Unknown top-level keys in processing_kwargs should emit a warning.
tests/base/modules/test_transformer.py:246
Methodtest_processing_kwargs_valid_keys_no_warning
Valid processing_kwargs keys should not emit a warning.
tests/base/modules/test_transformer.py:252
Methodtest_processor_generated_labels_are_discarded
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:546
Functiontest_projection_autocast_preserves_teacher_precision
( word_embeddings_model: SentenceTransformer, dtype: torch.dtype )
tests/sentence_transformer/losses/test_embed_distill.py:291
Methodtest_projection_dim_for_sentence_embedding
When module_output_name is 'sentence_embedding', projection_dim takes priority.
tests/base/modules/test_transformer.py:1165
Functiontest_projection_dim_matches_teacher
projection_dim should produce a Linear that outputs teacher_dim.
tests/sentence_transformer/losses/test_embed_distill.py:115
Functiontest_projection_layer_changes_during_training
The projection layer should receive gradients and update its weights.
tests/sentence_transformer/losses/test_embed_distill.py:93
Functiontest_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
Functiontest_prompt_combinations
Test various prompt configurations.
tests/util/test_hard_negatives.py:1569
Methodtest_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
Methodtest_prompt_length_cached
Second call with the same prompt should use the cache.
tests/base/modules/test_transformer.py:1185
Functiontest_prompt_length_calculation
( stsb_bert_tiny_model: SentenceTransformer, has_bos_token: bool, has_eos_token: bool )
tests/sentence_transformer/test_model.py:456
Methodtest_prompt_length_excludes_special_tokens
Prompt length should exclude trailing special tokens like [SEP].
tests/base/modules/test_transformer.py:1202
Functiontest_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
Functiontest_prompt_output_value_None
(stsb_bert_tiny_model)
tests/sentence_transformer/test_model.py:432
Functiontest_prompts
(stsb_bert_tiny_model: SentenceTransformer, caplog: pytest.LogCaptureFixture)
tests/sentence_transformer/test_model.py:359
Functiontest_prompts
(splade_bert_tiny_model: SparseEncoder, caplog: pytest.LogCaptureFixture)
tests/sparse_encoder/test_model.py:736
Functiontest_prompts
Test query_prompt and corpus_prompt parameters.
tests/util/test_hard_negatives.py:415
Functiontest_proportional_no_duplicates
( dummy_duplicates_dataset: Dataset, drop_last: bool, precompute_hashes: bool )
tests/base/samplers/test_no_duplicates_batch_sampler.py:148
Functiontest_push_from_checkpoint_copies_full_layout
(static_embedding_model: SentenceTransformer, tmp_path: Path)
tests/base/test_trainer.py:54
Functiontest_push_from_checkpoint_skips_when_end_strategy
( static_embedding_model: SentenceTransformer, tmp_path: Path )
tests/base/test_trainer.py:112
Functiontest_push_to_hub
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFix
tests/sentence_transformer/test_model.py:121
Functiontest_push_to_hub
( reranker_bert_tiny_model: CrossEncoder, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixtur
tests/cross_encoder/test_model.py:537
Functiontest_push_to_hub_commit_message_includes_backend
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:875
Functiontest_push_to_hub_create_branch_on_revision
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:885
Functiontest_push_to_hub_create_pr_commit_description_cross_encoder
( reranker_bert_tiny_model: CrossEncoder, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:829
Functiontest_push_to_hub_create_pr_commit_description_sentence_transformer
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:808
Functiontest_push_to_hub_create_pr_commit_description_sparse_encoder
( splade_bert_tiny_model: SparseEncoder, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:847
Functiontest_push_to_hub_no_commit_description_without_create_pr
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/base/test_model.py:865
Functiontest_push_to_hub_sparse_encoder
(splade_bert_tiny_model: SparseEncoder, monkeypatch: pytest.MonkeyPatch)
tests/base/test_model.py:789
Functiontest_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
Functiontest_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
Functiontest_pytorch_cos_sim
Tests the correct computation of pytorch_cos_sim
tests/util/test_similarity.py:29
Functiontest_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
Functiontest_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
Functiontest_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
Functiontest_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
Functiontest_qdrant_uploads_sparse_values
(stub_qdrant_module, dtype: torch.dtype)
tests/sparse_encoder/test_search_engines.py:155
Functiontest_quantize_bfloat16_tensors
(precision: str, input_type: str)
tests/util/test_quantization.py:671
Functiontest_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
Functiontest_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
Functiontest_quantize_multi_vector_calibrates_once
Ragged documents share one calibration scan, regardless of the number of documents.
tests/util/test_quantization.py:210
Functiontest_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
Functiontest_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
Functiontest_query_expansion_rejects_count_key
()
tests/multi_vector_encoder/test_model.py:148
Functiontest_query_expansion_requires_length
()
tests/multi_vector_encoder/test_model.py:137
Functiontest_query_expansion_requires_mask_or_eos_token
()
tests/multi_vector_encoder/test_model.py:158
Functiontest_query_expansion_setter_validates_post_init
()
tests/multi_vector_encoder/test_model.py:261
Functiontest_query_expansion_strategy_invalid_value_raises
()
tests/multi_vector_encoder/test_model.py:121
Functiontest_query_expansion_token_not_in_vocab_raises
()
tests/multi_vector_encoder/test_model.py:181
Functiontest_query_expansion_unknown_key_raises
()
tests/multi_vector_encoder/test_model.py:129
Functiontest_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
Functiontest_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
Functiontest_qwen3_reranker_formatted_pairs
Test Qwen3 Reranker with manually formatted query-document pairs.
tests/cross_encoder/test_model.py:1134
Functiontest_qwen3_reranker_original_with_identity_activation
Test original Qwen3 Reranker with Identity activation function.
tests/cross_encoder/test_model.py:1199
Functiontest_qwen3_reranker_original_without_prompt
Test original Qwen3 Reranker with Identity activation function.
tests/cross_encoder/test_model.py:1269
Functiontest_qwen3_reranker_with_chat_template
Test Qwen3 Reranker with Chat template.
tests/cross_encoder/test_model.py:1162
Methodtest_ragged_lists_raise
(self, documents: Dataset)
tests/util/test_dataset.py:44
Methodtest_ragged_lists_unified_by_max_list_length
(self, documents: Dataset)
tests/util/test_dataset.py:49
Methodtest_ragged_rows_allowed
(self, documents: Dataset)
tests/util/test_dataset.py:97
Functiontest_raises_on_invalid_batch_size
(two_label_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:114
Functiontest_raises_on_single_label
()
tests/base/samplers/test_group_by_label_batch_sampler.py:107
Methodtest_raises_when_no_dimension_found
Should raise ValueError when no dimension attribute is found.
tests/base/modules/test_transformer.py:1157
Functiontest_rand_context_mps
(rand_context_path: str)
tests/sentence_transformer/losses/test_cmnrl.py:177
Functiontest_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
Functiontest_rand_context_working
(use_rand_context: bool)
tests/sentence_transformer/losses/test_cmnrl.py:142
Functiontest_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
Functiontest_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
Functiontest_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
Functiontest_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
Functiontest_range_parameters
Test range_min and range_max parameters.
tests/util/test_hard_negatives.py:327
Methodtest_ranges_cover_the_batch_exactly
(self)
tests/sentence_transformer/losses/test_gradcache.py:301
Functiontest_rank
(return_documents: bool, reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:129
Functiontest_rank_apply_softmax_deprecated
(reranker_bert_tiny_model: CrossEncoder, apply_softmax: bool, caplog)
tests/cross_encoder/test_model.py:179
Functiontest_rank_convert_kwargs_deprecated
(reranker_bert_tiny_model: CrossEncoder, kwarg: str, caplog)
tests/cross_encoder/test_model.py:168
← previousnext →3,801–3,900 of 4,575, ranked by callers