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_merge_treats_tensor_prompt_lengths_as_metadata
Pooling also supports tensor-valued prompt lengths and reads one value for the whole batch, so concatenating per-column tensors would silently app
tests/sentence_transformer/losses/test_merged_forward.py:231
Function
test_mergekit_normalization_defaults
(model)
tests/test_merging.py:96
Method
test_merges_config_and_overrides
_load_init_kwargs should merge config, hub_kwargs, user overrides, and pass cache_dir for the decorator.
tests/base/modules/test_transformer.py:2038
Method
test_message_dict_inputs
(self)
tests/base/test_modality.py:733
Method
test_message_dict_not_pair
(self)
tests/base/test_modality.py:1325
Function
test_message_input_with_a_single_pair_role_is_not_checked
A hand-written message may use one pair role alone, and that is not a pair. The check guards the pair mapping, which always produces both roles i
tests/cross_encoder/test_model.py:1077
Function
test_met_requirements_load_normally
(stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path)
tests/base/test_model.py:1981
Function
test_metrics
(test_data, mock_model, tmp_path: Path)
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:206
Function
test_metrics_are_independent_of_corpus_chunk_size
Duplicate documents produce exact score ties: breaking them by corpus_id keeps every metric identical across corpus_chunk_size values.
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:171
Method
test_min_expansion_attend_scopes_to_expansion_positions
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:960
Method
test_min_expansion_ceiling_via_max_length
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:950
Method
test_min_expansion_leaves_long_queries_untruncated
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:921
Method
test_min_expansion_mixed_batch_positions_per_row
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:935
Method
test_min_expansion_pads_short_queries_to_floor
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:910
Function
test_min_score_after_margin_removes_all_candidates
(margin: str)
tests/util/test_hard_negatives.py:1925
Function
test_min_score_counts_only_remaining_candidates
(capsys: pytest.CaptureFixture)
tests/util/test_hard_negatives.py:1945
Function
test_min_score_preserves_random_candidate_pool
( dataset: Dataset, static_retrieval_mrl_en_v1_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch
tests/util/test_hard_negatives.py:308
Function
test_mine_hard_negatives_with_prompt
Tests that mine_hard_negatives runs with and without a prompt.
tests/util/test_hard_negatives.py:1694
Method
test_minibatch_full_batch
Slicing the full batch should return everything unchanged.
tests/sentence_transformer/losses/test_cmnrl.py:291
Method
test_minibatch_grid_rows_coincides_with_batch_size
When num_images == batch_size by coincidence (e.g. 3 samples with [2,1,0] images), num_images_per_sample must be used instead of assuming one
tests/sentence_transformer/losses/test_cmnrl.py:300
Method
test_minibatch_mixed_slice
Slicing samples 1-2 (one with image, one without) should get only sample 1's pixels.
tests/sentence_transformer/losses/test_cmnrl.py:282
Method
test_minibatch_multi_image_sample
Slicing sample 0 (2 images, 80 tokens) should get both images' pixel_values.
tests/sentence_transformer/losses/test_cmnrl.py:271
Method
test_minibatch_single_image_sample
Slicing sample 1 (1 image, 24 tokens) should get the correct pixel_values slice.
tests/sentence_transformer/losses/test_cmnrl.py:260
Method
test_minibatch_text_only_samples
Text-only mini-batches must not invoke the vision encoder.
tests/sentence_transformer/losses/test_cmnrl.py:252
Function
test_minority_labels_participate
Labels with >= 2 samples should have their (even-trimmed) samples appear in the output.
tests/base/samplers/test_group_by_label_batch_sampler.py:137
Function
test_mismatched_pairs_still_count_as_wrong
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/evaluation/test_translation_evaluator.py:29
Function
test_missing_build_falls_back_and_other_errors_propagate
(loader, monkeypatch, embeddings)
tests/test_kernels.py:884
Function
test_missing_full_dim_warns
(caplog)
tests/multi_vector_encoder/losses/test_matryoshka.py:177
Method
test_missing_id_raises
(self)
tests/util/test_dataset.py:441
Method
test_missing_id_raises_keyerror
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:311
Method
test_missing_int_id_message_matches_dict_path
(self)
tests/util/test_dataset.py:499
Function
test_missing_labels_raises
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/losses/test_embed_distill.py:23
Method
test_missing_method_error
forward should raise ValueError when the model doesn't have the requested method.
tests/base/modules/test_transformer.py:790
Function
test_missing_negatives
( capsys: pytest.CaptureFixture, request: pytest.FixtureRequest, static_retrieval_mrl_en_v1_model:
tests/util/test_hard_negatives.py:1847
Function
test_missing_negatives_message_names_range_max
With only range_max to suggest, the "Could not find enough negatives" message must still name it instead of printing an empty parameter list.
tests/util/test_hard_negatives.py:2014
Function
test_missing_positives
(always_rerank_positives: bool, at_k: int)
tests/cross_encoder/evaluation/test_reranking.py:138
Function
test_missing_positives
(documents: list[str], at_k: int)
tests/sparse_encoder/test_reciprocal_rank_fusion.py:83
Function
test_missing_positives_with_tied_scores
()
tests/cross_encoder/evaluation/test_reranking.py:183
Method
test_missing_token_counts_raise
(self)
tests/sentence_transformer/losses/test_gradcache.py:307
Function
test_missing_ward_build_computes_reference_distances_on_cpu
(loader, monkeypatch)
tests/test_kernels.py:906
Method
test_mixed_batch_one_multimodal
A batch is not text-only if any sample contains non-text content.
tests/base/test_modality.py:1542
Function
test_mixed_gpu_offload_map_with_auxiliary_dense
(tmp_path: Path, offload: str)
tests/base/test_model.py:1578
Method
test_mixed_images_and_videos
(self)
tests/base/modules/test_transformer.py:2417
Method
test_mixed_modalities_batch_to_message
(self)
tests/base/test_modality.py:922
Function
test_mixed_score_groups_match_threshold_metrics
()
tests/sentence_transformer/evaluation/test_paraphrase_mining_evaluator.py:98
Method
test_mixed_single_and_multimodal_dict
Image + text+image dict should produce valid structured messages for both.
tests/base/test_modality.py:931
Method
test_mixed_singles_and_pairs
(self)
tests/base/test_modality.py:1235
Method
test_mixed_text_and_audio_returns_message
(self)
tests/base/test_modality.py:366
Method
test_mixed_text_and_image_returns_message
(self)
tests/base/test_modality.py:360
Method
test_mixed_text_and_image_splits_queries_documents
(self)
tests/multi_vector_encoder/test_model_card.py:129
Method
test_mixed_text_and_images
A mix of strings and images in usage_examples.
tests/base/test_model_card.py:363
Method
test_mixed_text_and_non_text_pairs_all_get_query_document_roles
When a batch mixes text pairs and non-text pairs, text pairs must also go through pair_to_messages so they get query/document roles, not user
tests/base/test_modality.py:1478
Function
test_mlm_example_trains_with_transformers_v5
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/sentence_transformer/test_trainer.py:78
Function
test_mnr_fixed_length_regression
When all document columns share the same T (text / fixed-resolution VLM case), the new pad logic is a no-op: same batch, same loss as before.
tests/multi_vector_encoder/losses/test_misc.py:326
Function
test_mnr_gather_across_devices_single_process_matches_no_gather
On a single process ``gather_across_devices=True`` must be a no-op: ``all_gather`` falls back to the local tensor and ``all_gather_padded`` skips
tests/multi_vector_encoder/losses/test_misc.py:462
Function
test_mnr_handles_varlen_document_columns
(varlen_features)
tests/multi_vector_encoder/losses/test_misc.py:94
Function
test_mnr_loss_does_not_scale_with_world_size
A 2-rank gather returning ``[local; local]`` doubles every query's candidate pool with an exact copy, which costs exactly ``log(2)`` of cross-entr
tests/multi_vector_encoder/losses/test_misc.py:559
Function
test_mnr_pad_positions_do_not_influence_loss
Sanity: corrupting the (would-be-)padded positions of the shorter column to a value that would dominate MaxSim must NOT change the loss, because t
tests/multi_vector_encoder/losses/test_misc.py:293
Function
test_mnr_rejects_non_positive_scale
scale=0.0 zeroes every gradient and a negative scale trains backwards, so the constructor must reject both, matching the dense MultipleNegativesRa
tests/multi_vector_encoder/losses/test_misc.py:823
Function
test_mnrl_merged_forward_matches_per_column
MNRL merges only the document columns, keeping the query column on its own forward: merged, chunked, and per-column fallback paths must all produc
tests/multi_vector_encoder/losses/test_misc.py:710
Function
test_mnrl_merged_gradients_match_per_column
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/losses/test_merged_forward.py:120
Method
test_modalities_property
Test that the modalities property returns a list.
tests/base/modules/transformer/test_feature_extraction.py:124
Method
test_modality_config_requires_module_output_name
(self)
tests/base/modules/test_transformer.py:538
Method
test_modality_row_in_stats_table
The rendered stats_table contains a modality row alongside type and details.
tests/base/test_model_card.py:955
Method
test_model_args_deprecated
(self, caplog)
tests/base/modules/test_transformer.py:488
Function
test_model_binding_and_reference_checkpoint
(loader, embeddings, tmp_path)
tests/test_kernels.py:190
Function
test_model_card_base
( stsb_bert_tiny_model: SentenceTransformer, dummy_dataset: Dataset, num_datasets: int, expect
tests/sentence_transformer/test_model_card.py:117
Function
test_model_card_base
( mve_bert_tiny_model: MultiVectorEncoder, dummy_dataset: Dataset, num_datasets: int, expected
tests/multi_vector_encoder/test_model_card.py:229
Function
test_model_card_base
( dummy_dataset: Dataset, num_datasets: int, num_labels: int, expected_substrings: list[str] )
tests/cross_encoder/test_model_card.py:134
Function
test_model_card_base
( model_fixture_name: str, dummy_dataset: Dataset, num_datasets: int, expected_substrings: lis
tests/sparse_encoder/test_model_card.py:159
Function
test_model_card_data
(revision, expected_base_revision)
tests/sentence_transformer/test_model_card_data.py:18
Function
test_model_card_renders_query_and_document_lengths
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model_card.py:162
Function
test_model_card_renders_query_and_document_lengths
( mve_bert_tiny_model: MultiVectorEncoder, knobs: dict[str, Any], expected_rows: str )
tests/multi_vector_encoder/test_model_card.py:281
Function
test_model_card_renders_query_and_document_lengths
(splade_bert_tiny_model: SparseEncoder)
tests/sparse_encoder/test_model_card.py:209
Function
test_model_card_reuse
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_trainer.py:291
Function
test_model_card_reuse
(reranker_bert_tiny_model_v54: CrossEncoder)
tests/cross_encoder/test_trainer.py:93
Function
test_model_card_reuse
(splade_bert_tiny_model: SparseEncoder)
tests/sparse_encoder/test_trainer.py:44
Function
test_model_card_save_update_model_id
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:802
Function
test_model_card_set_transform
(stsb_bert_tiny_model: SentenceTransformer, dummy_dataset: Dataset)
tests/sentence_transformer/test_model_card.py:358
Function
test_model_card_set_transform
(dummy_dataset: Dataset, reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model_card.py:162
Function
test_model_card_set_transform
( splade_bert_tiny_model: SparseEncoder, dummy_dataset: Dataset, tmp_path: Path )
tests/sparse_encoder/test_model_card.py:230
Method
test_model_card_with_image_only_usage_examples
Image-only usage_examples generates single-modality snippet.
tests/base/test_model_card.py:1029
Method
test_model_card_with_image_usage_examples
Image usage_examples causes multimodal snippet generation.
tests/base/test_model_card.py:1007
Method
test_model_card_with_model_id
model_id flows through to the generated card.
tests/base/test_model_card.py:987
Function
test_model_config_routes_backbone_maxsim_and_ward_without_mutating_inputs
(loader, monkeypatch, embeddings)
tests/test_kernels.py:831
Function
test_model_dimension_none_no_validation
Test that when model dimension is None, no validation or warning occurs.
tests/sentence_transformer/losses/test_matryoshka.py:120
Function
test_model_dimension_not_in_dims_warns
Test that model dimension not in matryoshka_dims produces warning.
tests/sentence_transformer/losses/test_matryoshka.py:96
Function
test_model_dtypes
(model: SentenceTransformer, features: list[dict[str, torch.Tensor]], dtype: torch.dtype)
tests/sentence_transformer/losses/test_softmax.py:29
Function
test_model_enables_default_cuda_providers
(loader, monkeypatch, embeddings, options)
tests/test_kernels.py:869
Method
test_model_forward_params_matches_kwargs_support
``model_forward_params`` is ``None`` exactly when forward accepts ``**kwargs`` (the denylist path). Otherwise it is an allowlist set seeded wi
tests/base/modules/test_transformer.py:869
Function
test_model_keeps_reference_scoring_without_matching_kernels
(loader, embeddings, preferences)
tests/test_kernels.py:169
Function
test_model_kernel_config_is_copied_and_local
(loader, embeddings)
tests/test_kernels.py:176
Function
test_model_kernel_options_require_torch_backend
(model_class)
tests/test_kernels.py:862
Function
test_model_kwargs_can_disable_backbone_with_top_level_config
(loader, embeddings, model_class)
tests/test_kernels.py:718
Function
test_model_loads_relative_dense_module
(tmp_path: Path, path: str)
tests/base/test_model.py:2228
Function
test_model_path_pointing_to_a_file_is_rejected
A path that exists but is not a directory is not a local model, and must be rejected before any loading happens. `load_file_path` only skips its H
tests/base/test_model.py:730
Function
test_model_rejects_external_dense_module
(tmp_path: Path, absolute: bool, trust_remote_code: bool)
tests/base/test_model.py:2213
Function
test_model_rejects_invalid_kernel_config
()
tests/test_kernels.py:185
Method
test_model_type
(self)
tests/multi_vector_encoder/test_model_card.py:166
Function
test_model_type_inherited_for_cross_encoder_subclass
Same inheritance and routing for CrossEncoder subclasses.
tests/base/test_model_type_subclass.py:42
← previous
next →
3,301–3,400 of 4,575, ranked by callers