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
Method
test_numbering_from_singular_base
(self, documents: Dataset, input_col: str, output_base: str)
tests/util/test_dataset.py:237
Function
test_odd_label_groups_do_not_permanently_exclude_samples
()
tests/base/samplers/test_group_by_label_batch_sampler.py:256
Function
test_offloaded_inference_for_each_model_family
( request: pytest.FixtureRequest, tmp_path: Path, model_fixture: str, encode_method: str,
tests/base/test_model.py:1423
Function
test_offloaded_static_embedding
(tmp_path: Path, prebuilt: bool, execution_device: str)
tests/base/test_model.py:1296
Function
test_old_fit_with_embedding_similarity_evaluator_saves_best_model
(stsb_bert_tiny_model, tmp_path)
tests/sentence_transformer/test_trainer.py:1508
Function
test_old_fit_with_evaluator_saves_best_model_and_calls_callback
( stsb_bert_tiny_model, tmp_path, dict_scores: bool )
tests/sentence_transformer/test_trainer.py:1475
Function
test_old_mergekit_error
(model, monkeypatch)
tests/test_merging.py:399
Method
test_old_name_is_renamed
(self, caplog)
tests/util/test_decorators.py:25
Function
test_one_column_dataset_raises_value_error
(queries)
tests/util/test_hard_negatives.py:2031
Function
test_one_hot_labels_match_class_indices
( model: SentenceTransformer, features: list[dict[str, torch.Tensor]], column_labels: bool )
tests/sentence_transformer/losses/test_softmax.py:60
Function
test_online_contrastive_keeps_single_hard_pairs
(distances, labels, expected, expected_gradient)
tests/sentence_transformer/losses/test_contrastive.py:107
Function
test_online_contrastive_loss_does_not_warn_for_binary_labels
()
tests/sentence_transformer/losses/test_contrastive.py:87
Function
test_online_contrastive_loss_warns_once_for_non_binary_labels
()
tests/sentence_transformer/losses/test_contrastive.py:70
Function
test_onnx_export_keeps_external_data
The weights of a model over 2GB live beside the ONNX file, so they have to be saved with it.
tests/backend/test_utils.py:154
Function
test_onnx_export_keeps_external_data_in_subdirectories
Weights may sit in a subdirectory, and the model keeps pointing at them only if that is kept. Optimum writes a plain file name beside the model,
tests/backend/test_utils.py:204
Function
test_onnx_export_keeps_external_data_of_node_attributes
The tensors held by node attributes get externalized as well, and those are not initializers.
tests/backend/test_utils.py:174
Function
test_onnx_export_keeps_external_data_of_subgraphs
The branches of an If, Loop or Scan node are graphs of their own, with their own weights.
tests/backend/test_utils.py:184
Function
test_onnx_export_keeps_external_data_spread_over_several_files
Weights can also be written one file per tensor, under names taken from the tensor names.
tests/backend/test_utils.py:194
Function
test_onnx_export_keeps_the_hub_external_data_name
Optimum already writes the name the Hub needs when exporting, so that model is left alone.
tests/backend/test_utils.py:235
Function
test_onnx_export_renames_external_data_for_the_hub
ONNX Runtime writes `<model>.onnx.data`, but only `<model>.onnx_data` is fetched from the Hub.
tests/backend/test_utils.py:224
Function
test_onnx_export_without_external_data
A model that fits within the protobuf limit has no separate weights file to look for.
tests/backend/test_utils.py:164
Function
test_onnx_optimize_and_quantize
(model_dir, torch_embeddings, tmp_path)
tests/multi_vector_encoder/test_backends.py:92
Function
test_onnx_provider_crash
()
tests/sentence_transformer/test_backends.py:100
Function
test_onnx_provider_crash
()
tests/cross_encoder/test_backends.py:106
Function
test_onnx_provider_crash
()
tests/sparse_encoder/test_backends.py:103
Function
test_onnx_push_to_hub_uploads_external_data
A model whose weights are left behind is uploaded broken, which is what the Hub then serves.
tests/backend/test_utils.py:246
Function
test_onnx_push_to_hub_uploads_external_data_of_subgraphs
Weights spread over several files keep their names, since no single one is the one to fetch.
tests/backend/test_utils.py:257
Function
test_opensearch_v2_distill_similarity
Test OpenSearch v2 distill model produces expected similarity scores.
tests/sparse_encoder/test_opensearch_models.py:11
Function
test_opensearch_v3_distill_similarity
Test OpenSearch v3 distill model produces expected similarity scores.
tests/sparse_encoder/test_opensearch_models.py:87
Function
test_openvino_backend
()
tests/sentence_transformer/test_backends.py:141
Function
test_openvino_backend
()
tests/cross_encoder/test_backends.py:147
Function
test_openvino_backend
()
tests/sparse_encoder/test_backends.py:144
Function
test_openvino_provider
()
tests/sentence_transformer/test_backends.py:109
Function
test_openvino_provider
()
tests/cross_encoder/test_backends.py:115
Function
test_openvino_provider
()
tests/sparse_encoder/test_backends.py:112
Method
test_opt_output_dimension
(self, word_embed_proj_dim)
tests/base/modules/test_transformer.py:1119
Function
test_other_models_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:97
Function
test_output_dtype_and_buffers
(model, dtype)
tests/test_merging.py:159
Function
test_output_formats
Test all output_format options.
tests/util/test_hard_negatives.py:527
Method
test_output_hidden_states
When output_hidden_states is True, all_layer_embeddings should appear in features.
tests/base/modules/test_transformer.py:847
Method
test_output_keys_are_prefixed
(self)
tests/base/test_data_collator.py:26
Method
test_output_order_follows_lookups_insertion
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:59
Function
test_output_owns_tensors_when_method_returns_inputs
(model, monkeypatch)
tests/test_merging.py:132
Method
test_oversized_sequence_gets_its_own_minibatch
(self)
tests/sentence_transformer/losses/test_gradcache.py:293
Function
test_pad_expansion_query_length_conflict_raises
With strategy='fixed', queries tokenize directly to the expansion length, so a smaller query_length content cap is inexpressible and fails loud wh
tests/multi_vector_encoder/test_model.py:1854
Method
test_padded_and_flattened_agree
(self)
tests/sentence_transformer/losses/test_gradcache.py:281
Method
test_padding_does_not_count
(self)
tests/sentence_transformer/losses/test_gradcache.py:288
Function
test_pair_losses_embed_each_column_separately
A two-column loss splits its anchor off and has no second candidate left to merge it with, which is deliberate: these losses are trained on a quer
tests/sentence_transformer/losses/test_merged_forward.py:267
Function
test_pairwise_angle_sim_even_and_odd_sparse_embeddings
Ensure pairwise_angle_sim works for even and artificially odd dims.
tests/util/test_similarity.py:427
Function
test_pairwise_angle_sim_input_types
(convert_x, convert_y)
tests/util/test_similarity.py:402
Function
test_pairwise_angle_sim_matches_legacy_gradients
Gradients w.r.t. both inputs must match the previous implementation (#3223).
tests/util/test_similarity.py:497
Function
test_pairwise_angle_sim_matches_legacy_values
Clearer cos+sin form must match the previous complex-chunk outputs (#3223).
tests/util/test_similarity.py:482
Function
test_pairwise_angle_sim_mixed_sparse_dense
Test that mixing a sparse and a dense operand matches the all-dense result.
tests/util/test_similarity.py:413
Function
test_pairwise_cos_sim
()
tests/util/test_similarity.py:41
Function
test_pairwise_cos_sim_single_sparse_vectors
Two 1D sparse embeddings, as returned by `SparseEncoder.encode()` for single inputs, score like dense ones.
tests/util/test_similarity.py:240
Function
test_pairwise_cos_sim_sparse
Test pairwise cosine similarity with sparse tensors.
tests/util/test_similarity.py:227
Function
test_pairwise_dot_score_cos_sim
()
tests/util/test_similarity.py:95
Function
test_pairwise_dot_score_sparse
Test pairwise dot product with sparse tensors.
tests/util/test_similarity.py:251
Function
test_pairwise_euclidean_sim
()
tests/util/test_similarity.py:52
Function
test_pairwise_euclidean_sim_has_finite_gradients_for_identical_embeddings
()
tests/util/test_similarity.py:72
Function
test_pairwise_euclidean_sim_integer_inputs
(input_type)
tests/util/test_similarity.py:63
Function
test_pairwise_euclidean_sim_sparse
Test pairwise Euclidean similarity with sparse tensors.
tests/util/test_similarity.py:277
Function
test_pairwise_manhattan_sim
()
tests/util/test_similarity.py:85
Function
test_pairwise_manhattan_sim_sparse
Test pairwise Manhattan similarity with sparse tensors.
tests/util/test_similarity.py:264
Function
test_pairwise_scorers_match_the_diagonal_of_their_matrix_form
Both pairwise scorers are only covered by plumbing and naming assertions elsewhere. Their contract is that ``fn(q, d)[i]`` equals the ``(i, i)`` e
tests/multi_vector_encoder/losses/test_misc.py:585
Function
test_pairwise_scores_are_float32_for_low_precision_inputs
(fn, dtype)
tests/util/test_similarity.py:537
Function
test_parameterless_cross_encoder_uses_requested_device_for_empty_predictions
()
tests/base/test_model.py:1413
Function
test_parameterless_model_uses_requested_input_device
(inputs: list[str], model_class: type)
tests/base/test_model.py:1395
Function
test_paraphrase_mining
()
tests/util/test_retrieval.py:99
Function
test_paraphrase_mining_embeddings_dot_product_excludes_self
( query_chunk_size: int, corpus_chunk_size: int, top_k: int, expected: list[list[float | int]] )
tests/util/test_retrieval.py:213
Function
test_paraphrase_mining_embeddings_preserves_score_buffer
()
tests/util/test_retrieval.py:227
Function
test_paraphrase_mining_embeddings_respects_max_pairs_capacity
(max_pairs: int, expected_count: int)
tests/util/test_retrieval.py:119
Function
test_paraphrase_mining_embeddings_respects_max_pairs_with_symmetric_scores
(max_pairs: int)
tests/util/test_retrieval.py:146
Function
test_paraphrase_mining_embeddings_returns_top_max_pairs
( score_function: Callable[[torch.Tensor, torch.Tensor], torch.Tensor], max_pairs: int )
tests/util/test_retrieval.py:158
Function
test_paraphrase_mining_embeddings_top_k_is_per_sentence
( query_chunk_size: int, corpus_chunk_size: int, top_k: int, max_pairs: int )
tests/util/test_retrieval.py:180
Function
test_parse_model_config_composes_pylate_prefix_with_prompts
A PyLate save can carry both ``query_prefix`` and ``prompts``. PyLate applies both, so the prefix composes onto the front of the saved prompt rath
tests/multi_vector_encoder/test_model.py:605
Function
test_parse_model_config_default_prompt_name
( stsb_bert_tiny_model: SentenceTransformer, initial_default, config_default, expected_default )
tests/base/test_model.py:1934
Function
test_parse_model_config_ignores_multi_vector_similarity
A saved multi-vector similarity (e.g. converting a MultiVectorEncoder save) falls through to the default instead of raising in the strict setter d
tests/sentence_transformer/test_model.py:1446
Function
test_parse_model_config_ignores_multi_vector_similarity
A saved multi-vector similarity falls through to the default instead of raising in the strict setter during config parsing.
tests/sparse_encoder/test_model.py:979
Function
test_parse_model_config_prompts
( stsb_bert_tiny_model: SentenceTransformer, initial_prompts, config_prompts, expected_prompts )
tests/base/test_model.py:1917
Function
test_parse_model_config_reads_back_supported_similarity
A saved ``similarity_fn_name`` is read back on load when supported. Legacy dense names (cosine / dot) are ignored so the model falls through to th
tests/multi_vector_encoder/test_model.py:1175
Function
test_parse_model_config_translates_pylate_expansion
``_parse_model_config`` translates legacy PyLate-shape expansion fields (``do_query_expansion`` + ``attend_to_expansion_tokens``, with the Stanfor
tests/multi_vector_encoder/test_model.py:541
Function
test_passthrough_only_matches_wrapped_loss
(build_inner, use_none: bool)
tests/multi_vector_encoder/losses/test_token_pooling.py:77
Method
test_passthrough_pil_image
(self)
tests/base/test_model_card.py:1241
Method
test_passthrough_string
(self)
tests/base/test_model_card.py:1237
Function
test_peft_adapter_on_single_input_or_base_rejected
(stsb_bert_tiny_model, position)
tests/test_merging.py:358
Function
test_peft_adapter_save_load_round_trip
(tmp_path)
tests/multi_vector_encoder/test_model.py:202
Function
test_peft_adapters_rejected
(stsb_bert_tiny_model, lora_alpha)
tests/test_merging.py:346
Method
test_peft_modules_to_save_selection
(self)
tests/cross_encoder/test_model.py:1510
Method
test_peft_non_torch_backend_error
PEFT models should raise an error for non-torch backends.
tests/base/modules/test_transformer.py:1807
Method
test_peft_seq_classification_resolves_base_config
A PeftConfig has no 'architectures', so the base model's config decides `num_labels`.
tests/base/modules/test_transformer.py:1768
Method
test_peft_seq_classification_roundtrip
A saved adapter checkpoint reloads as a sequence-classification model with one label.
tests/base/modules/test_transformer.py:1791
Method
test_per_call_chat_template_overrides_instance_via_preprocess
Per-call ``processing_kwargs={'chat_template': ...}`` should override instance-level via preprocess.
tests/base/modules/test_transformer.py:1329
Method
test_pil_image
(self)
tests/base/test_modality.py:162
Method
test_pil_image_not_affected_by_supported_modalities
Non-string inputs are unambiguous and should not be overridden by supported_modalities.
tests/base/test_modality.py:314
Method
test_pil_image_placeholder
(self)
tests/base/test_model_card.py:256
Method
test_pil_image_saved_as_jpg
A PIL image in usage_examples is saved to assets/image_0.jpg.
tests/base/test_model_card.py:298
Method
test_pil_unavailable_image_url_still_works
(self, monkeypatch)
tests/base/test_modality.py:408
Method
test_pil_unavailable_text_still_works
(self, monkeypatch)
tests/base/test_modality.py:404
Function
test_pinned_sentence_level_dense_survives_load
A Dense that explicitly pins sentence-level IO names in its saved config is left untouched: the token-level default only fills configs that omitte
tests/multi_vector_encoder/test_model.py:887
← previous
next →
3,601–3,700 of 4,575, ranked by callers