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
stub_qdrant_module
Qdrant is not a test dependency, so stand in for the imports that the function performs.
tests/sparse_encoder/test_search_engines.py:114
Function
stub_seismic_module
Seismic is not a test dependency, so stand in for the import that the function performs.
tests/sparse_encoder/test_search_engines.py:23
Method
temperature
(self)
sentence_transformers/sentence_transformer/losses/multiple_negatives_ranking.py:352
Method
temperature
(self)
sentence_transformers/sentence_transformer/losses/cached_multiple_negatives_ranking.py:394
Function
test_2d_labels_broadcast_across_columns
2D labels with multi-column input = same target broadcast (multilingual-distillation case).
tests/sentence_transformer/losses/test_embed_distill.py:59
Method
test_3d_bad_padding_side_raises
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:653
Method
test_3d_bad_padding_side_raises_even_with_mask
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:659
Method
test_3d_input_empty_batch
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:645
Method
test_3d_input_left_padded_with_mask
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:628
Method
test_3d_input_left_padding_round_trip
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:74
Method
test_3d_input_returns_3d
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:64
Function
test_3d_labels_column_count_mismatch_raises
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/losses/test_embed_distill.py:84
Function
test_3d_labels_per_column
3D labels supply a different teacher embedding per text column.
tests/sentence_transformer/losses/test_embed_distill.py:71
Method
test_3d_unbind_preserves_middle_zero_row
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:104
Method
test_4d_embedding_reshape
4D model outputs should be flattened to 3D.
tests/base/modules/test_transformer.py:798
Function
test_BinaryClassificationEvaluator_best_threshold_matches_predictions
( high_score_more_similar, scores, labels, expected_accuracy, expected_f1 )
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:72
Function
test_BinaryClassificationEvaluator_csv_columns_are_aligned
The results CSV data row must have as many columns as the header row. The ``*_accuracy_threshold`` and ``*_f1_threshold`` metrics contain a secon
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:163
Function
test_BinaryClassificationEvaluator_distance_metrics_direction
The euclidean/manhattan metrics must treat smaller distances as more similar. ``pairwise_euclidean_sim``/``pairwise_manhattan_sim`` return negati
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:97
Function
test_BinaryClassificationEvaluator_find_best_accuracy_and_threshold
Tests that the Acc score for the computed threshold is correct
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:34
Function
test_BinaryClassificationEvaluator_find_best_f1_and_threshold
Tests that the F1 score for the computed threshold is correct
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:17
Function
test_BinaryClassificationEvaluator_multiple_similarity_fn_names
Tests that the max_* aggregation does not assume that cosine was requested
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:144
Function
test_LabelAccuracyEvaluator
Tests that the LabelAccuracyEvaluator can be loaded correctly
tests/sentence_transformer/evaluation/test_label_accuracy_evaluator.py:20
Function
test_ParaphraseMiningEvaluator
Tests that the ParaphraseMiningEvaluator can be loaded
tests/sentence_transformer/evaluation/test_paraphrase_mining_evaluator.py:20
Function
test_ParaphraseMiningEvaluator_uses_model_similarity
Candidate pairs are scored with the model's similarity function, not always cosine.
tests/sentence_transformer/evaluation/test_paraphrase_mining_evaluator.py:115
Function
test_TripletEvaluator
Tests that the TripletEvaluator can be loaded & used
tests/sentence_transformer/evaluation/test_triplet_evaluator.py:13
Method
test_absent_keep_columns_ignored
(self, queries: Dataset)
tests/util/test_dataset.py:209
Method
test_accelerate_hook_preserves_custom_forward_rejection
(self)
tests/cross_encoder/test_model.py:1468
Method
test_accelerate_hooks
(self, offload, selected_before_dispatch)
tests/cross_encoder/test_model.py:1433
Function
test_accepts_a_tokenizer_without_a_vocab_attribute
(loss_class)
tests/sentence_transformer/losses/test_cached_gist_embed.py:51
Function
test_adaptive_layer_disables_merging_for_the_dict_replay
AdaptiveLayerLoss deposits ``all_layer_embeddings`` in the per-column feature dicts on the final-layer pass and reads it back on every prior-layer
tests/sentence_transformer/losses/test_merged_forward.py:151
Function
test_adaptive_layer_loss_error_names_inner_stuck_point
For nested wrappers the error should name both the outer wrapper (what the user passed in) and the inner object the unwrap got stuck on.
tests/sentence_transformer/losses/test_adaptive_layer.py:159
Function
test_adaptive_layer_loss_invalid_layer_weighting
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/losses/test_adaptive_layer.py:269
Function
test_adaptive_layer_loss_kl_teacher_is_detached
Regression test for #3757: the final-layer embeddings are the (teacher) target of the self-distillation KL loss and must be detached, so no gradie
tests/sentence_transformer/losses/test_adaptive_layer.py:170
Function
test_adaptive_layer_loss_layer_weighting
Each prior layer loss is scaled by the scheme's weight for its layer index, averaged over the number of sampled layers. KL is disabled so the tota
tests/sentence_transformer/losses/test_adaptive_layer.py:230
Function
test_adaptive_layer_loss_layer_weighting_in_config_dict
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/losses/test_adaptive_layer.py:257
Function
test_adaptive_layer_loss_prior_layers_see_the_collated_mask
Each prior-layer pass re-runs the pooling half over the same feature dicts. If pooling wrote its prompt-excluded mask back into them, every pass a
tests/sentence_transformer/losses/test_adaptive_layer.py:61
Function
test_adaptive_layer_loss_raises_on_unrecognised_wrapper
If `self.model` is something we can't unwrap to a BaseModel, fail loudly instead of silently raising the cryptic `'X' object is not subscriptable`
tests/sentence_transformer/losses/test_adaptive_layer.py:148
Function
test_adaptive_layer_loss_runs_without_wrapper
Sanity check for the non-DDP, non-compile path: a bare SentenceTransformer skips the unwrap loop entirely.
tests/sentence_transformer/losses/test_adaptive_layer.py:84
Function
test_adaptive_layer_loss_unwraps_nested_wrappers
Compile-of-DDP and DDP-of-compile both need to unwrap to the inner BaseModel.
tests/sentence_transformer/losses/test_adaptive_layer.py:133
Function
test_adaptive_layer_loss_unwraps_wrapped_model
AdaptiveLayerLoss.forward reaches into `self.model[0]`. Under DDP / torch.compile the trainer rebinds `loss.model` to the wrapper (and binds BaseM
tests/sentence_transformer/losses/test_adaptive_layer.py:98
Function
test_adaptive_layer_warns_for_gradient_cached_losses
AdaptiveLayerLoss calls its base loss once per layer, which gradient caching cannot support. The ``uses_gradient_cache`` capability check must cat
tests/sentence_transformer/losses/test_gradcache.py:225
Function
test_add_transitive_closure_flag_still_expands_duplicates
Passing ``add_transitive_closure=True`` must still apply the transitive closure to the duplicates.
tests/sentence_transformer/evaluation/test_paraphrase_mining_evaluator.py:50
Function
test_add_transitive_closure_ignores_non_duplicate_pairs
(non_duplicate_id: str)
tests/sentence_transformer/evaluation/test_paraphrase_mining_evaluator.py:65
Method
test_all_deprecated_kwargs
Renames (sentences→inputs, activation_fct→activation_fn) are wired via deprecated_kwargs. num_workers is removed as a no-op.
tests/util/test_decorators.py:376
Method
test_all_fail_raises
When all strategies fail (no source path), RuntimeError is raised.
tests/base/test_model_card.py:1206
Function
test_all_models_configure_existing_backbones
(monkeypatch, model_class, selection)
tests/test_kernels.py:736
Function
test_all_models_enable_loaded_backbone_defaults
(loader, model_class)
tests/test_kernels.py:771
Method
test_allowlist_forward_filters_unknown_kwargs
When forward does not accept ``**kwargs`` (``model_forward_params`` is a set), forward() drops any feature key outside the allowlist.
tests/base/modules/test_transformer.py:1093
Method
test_already_in_target_format
(self)
tests/base/test_modality.py:544
Method
test_ambiguous_frame_urls_can_be_wrapped
(self)
tests/base/test_modality.py:1017
Method
test_ambiguous_id_inference
(self)
tests/util/test_dataset.py:281
Method
test_ambiguous_value_inference
(self)
tests/util/test_dataset.py:291
Function
test_anchor_exclusion_preserves_candidate_window
( use_faiss: bool, output_format: str, sampling_strategy: str )
tests/util/test_hard_negatives.py:2081
Function
test_anchor_is_not_mined_as_its_own_negative
( positives: list[str], include_positives: bool, expected_negatives: list[str] )
tests/util/test_hard_negatives.py:2060
Function
test_anchor_losses_keep_the_anchor_on_its_own_forward
Anchors (queries) are typically much narrower than the candidate columns, and merging them in would pad every anchor row to candidate width. Expec
tests/sentence_transformer/losses/test_merged_forward.py:99
Function
test_angle_loss_ranks_actual_angle_scores
(dummy_model, labels, score_difference)
tests/sentence_transformer/losses/test_cosent.py:43
Function
test_append_to_last_row
Only writes when there's a header plus at least one data row, and then appends every value to that row. Otherwise it no-ops and leaves the file un
tests/util/test_misc.py:219
Method
test_applies_pool_fn_per_sample
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:282
Method
test_array_text_pair
(self)
tests/base/test_modality.py:1308
Method
test_array_text_pairs
Audio array + text pairs should be converted to message format.
tests/base/test_modality.py:1468
Method
test_asset_path_with_model_id
(self)
tests/base/test_model_card.py:212
Method
test_asset_path_without_model_id
(self)
tests/base/test_model_card.py:219
Method
test_asset_src_urls_rewritten
Training example table asset paths are rewritten to absolute Hub URLs.
tests/base/test_model_card.py:1496
Method
test_asset_url_with_model_id
(self)
tests/base/test_model_card.py:196
Method
test_asset_url_without_model_id
(self)
tests/base/test_model_card.py:202
Function
test_asym_import
(module_name: str)
tests/base/modules/test_router.py:354
Method
test_attribute_fallback_for_output
forward should fall back to getattr when dict indexing fails on model output.
tests/base/modules/test_transformer.py:824
Method
test_audio_collection_unwraps_each_recording
(self, container)
tests/base/test_modality.py:698
Method
test_audio_dict
(self)
tests/base/test_model_card.py:174
Method
test_audio_dict_column_stats
(self, stsb_bert_tiny_model: SentenceTransformer)
tests/base/test_model_card.py:921
Method
test_audio_dict_placeholder
(self)
tests/base/test_model_card.py:262
Method
test_audio_dict_saved_as_wav
AudioDict saved to assets/ as .wav file.
tests/base/test_model_card.py:376
Method
test_audio_dict_unwraps_array_and_collects_sampling_rate
(self)
tests/base/test_modality.py:600
Method
test_audio_https_url
(self)
tests/base/test_modality.py:151
Method
test_audio_model_roundtrip
( self, tmp_path: Path, model_name: str, expected_class_name: str, extra_kwargs: dict )
tests/base/modules/test_transformer.py:2156
Method
test_audio_ndarray_inputs
(self)
tests/base/test_modality.py:587
Method
test_audio_url_detected_when_supported
(self)
tests/base/test_modality.py:326
Method
test_audio_url_falls_back_to_text_when_unsupported
(self)
tests/base/test_modality.py:305
Method
test_audio_url_with_spaces_not_audio
(self)
tests/base/test_modality.py:122
Method
test_auto_with_processor_infers_format
(self)
tests/base/test_modality.py:426
Method
test_auto_without_processor_defaults_to_structured
(self)
tests/base/test_modality.py:422
Function
test_autograd_mode_selects_inference_only_provider
(loader, embeddings)
tests/test_kernels.py:392
Function
test_backbone_settings_pass_through_model_kwargs
(loader, monkeypatch, embeddings, model_class)
tests/test_kernels.py:693
Function
test_backend_export
(backend, expected_auto_model_class, model_kwargs)
tests/sentence_transformer/test_backends.py:41
Function
test_backend_export
(backend, expected_auto_model_class, model_kwargs, model_dir, torch_embeddings)
tests/multi_vector_encoder/test_backends.py:74
Function
test_backend_export
(backend, expected_auto_model_class, model_kwargs)
tests/cross_encoder/test_backends.py:47
Function
test_backend_export
(backend, expected_auto_model_class, model_kwargs)
tests/sparse_encoder/test_backends.py:47
Function
test_backend_listing_uses_resolved_revision
(monkeypatch: pytest.MonkeyPatch)
tests/util/test_backend.py:12
Function
test_backend_load
(backend, model_id, model_kwargs, exception)
tests/sentence_transformer/test_backends.py:89
Function
test_backend_load
(backend, model_id, model_kwargs, exception)
tests/cross_encoder/test_backends.py:95
Function
test_backend_load
(backend, model_id, model_kwargs, exception)
tests/sparse_encoder/test_backends.py:92
Function
test_backend_no_export_crash
()
tests/sentence_transformer/test_backends.py:53
Function
test_backend_no_export_crash
()
tests/cross_encoder/test_backends.py:59
Function
test_backend_no_export_crash
()
tests/sparse_encoder/test_backends.py:56
Function
test_backend_save_and_load
(backend, model_dir, torch_embeddings, tmp_path)
tests/multi_vector_encoder/test_backends.py:83
Method
test_bad_input_type_raises
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:99
Function
test_bare_checkpoint_gets_no_expansion
()
tests/multi_vector_encoder/test_model.py:56
Method
test_bare_subclass_raises_not_implemented
(self)
tests/base/modules/test_input_module.py:73
Method
test_base_forward_via_lambda_pooling_variable_length
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:608
Method
test_base_hook_returns_router_mapping_entry
(self)
tests/base/test_data_collator.py:228
← previous
next →
2,201–2,300 of 4,575, ranked by callers