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_embedding_similarity_evaluator_csv_columns_are_aligned
( splade_bert_tiny_model: SparseEncoder, tmp_path: Path, similarity_fn_names: list[str] | None )
tests/sparse_encoder/evaluation/test_embedding_similarity_evaluator.py:13
Function
test_embedding_similarity_evaluator_precisions
Every supported precision must produce metrics.
tests/sentence_transformer/evaluation/test_embedding_similarity_evaluator.py:20
Function
test_embedding_similarity_evaluator_shared_quantization_ranges
Reversing a pair must not change the calibration or its symmetric similarity.
tests/sentence_transformer/evaluation/test_embedding_similarity_evaluator.py:38
Method
test_empty_batch
An empty batch is trivially text-only.
tests/base/test_modality.py:1550
Method
test_empty_batch
(self)
tests/base/modules/test_transformer.py:2446
Method
test_empty_batch
(self, queries: Dataset)
tests/util/test_dataset.py:66
Method
test_empty_chat_template_returns_structured
(self)
tests/base/test_modality.py:1280
Function
test_empty_dataset
Test behavior with an empty dataset.
tests/util/test_hard_negatives.py:1376
Method
test_empty_dict
(self)
tests/base/test_model_card.py:186
Method
test_empty_dict_returns_empty
(self)
tests/base/test_data_collator.py:115
Function
test_empty_dims_raises
()
tests/multi_vector_encoder/losses/test_matryoshka.py:153
Function
test_empty_document_score_survives_the_losses_that_consume_it
The sentinel must rank last AND stay finite through loss arithmetic (scaling, softmax, squared margins), which the float32 minimum did not.
tests/util/test_similarity.py:871
Function
test_empty_documents
()
tests/cross_encoder/evaluation/test_reranking.py:114
Function
test_empty_encode
( stsb_bert_tiny_model: SentenceTransformer, convert_to_tensor: bool, convert_to_numpy: bool,
tests/sentence_transformer/test_model.py:887
Function
test_empty_encode
( splade_bert_tiny_model: SparseEncoder, convert_to_tensor: bool, convert_to_sparse_tensor: bool,
tests/sparse_encoder/test_model.py:562
Method
test_empty_features
(self)
tests/base/test_data_collator.py:35
Method
test_empty_id_lists_raise_in_columns_mode
(self, documents: Dataset)
tests/util/test_dataset.py:364
Method
test_empty_index_raises_keyerror
(self)
tests/util/test_dataset.py:446
Method
test_empty_inputs_returns_empty_text
(self)
tests/base/test_modality.py:1241
Method
test_empty_list_input
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:87
Method
test_empty_lookup_dataset_reports_missing_id
(self)
tests/util/test_dataset.py:485
Function
test_empty_matryoshka_dims_raises_error
Test that empty matryoshka_dims raises ValueError.
tests/sentence_transformer/losses/test_matryoshka.py:51
Function
test_empty_modules_raises
Passing an empty modules list should raise ValueError.
tests/base/test_model.py:431
Function
test_empty_or_single_document_ranking
(documents: list[str])
tests/sparse_encoder/test_reciprocal_rank_fusion.py:114
Function
test_empty_predict
(reranker_bert_tiny_model: CrossEncoder, convert_to_numpy: bool, convert_to_tensor: bool)
tests/cross_encoder/test_model.py:357
Method
test_empty_string
(self)
tests/base/test_modality.py:53
Method
test_empty_string
(self)
tests/base/test_modality.py:87
Method
test_empty_string
(self)
tests/base/test_modality.py:114
Function
test_empty_variant_list_raises
()
tests/multi_vector_encoder/losses/test_token_pooling.py:285
Function
test_encode_advanced_parameters
Test that additional parameters are correctly passed to encode
tests/sentence_transformer/test_model.py:1197
Function
test_encode_advanced_parameters
Test that additional parameters are correctly passed to encode
tests/sparse_encoder/test_model.py:275
Function
test_encode_aligns_appended_dense_module
( stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path, explicit_device: bool, placement:
tests/base/test_model.py:1632
Function
test_encode_cpu_cuda_round_trip
( request: pytest.FixtureRequest, model_fixture: str, encode_method: str, inputs: list )
tests/base/test_model.py:1470
Function
test_encode_defaults_to_tensors_on_model_device
The default output feeds similarity without a host round trip, so it stays on the model's device as tensors. ``convert_to_numpy=True`` remains the
tests/multi_vector_encoder/test_model.py:767
Function
test_encode_document
( stsb_bert_tiny_model: SentenceTransformer, sentences: str | list[str], prompt_name: str | None,
tests/sentence_transformer/test_model.py:1079
Function
test_encode_document
( splade_bert_tiny_model: SparseEncoder, sentences: str | list[str], convert_to_tensor: bool,
tests/sparse_encoder/test_model.py:873
Function
test_encode_document_default_skiplist_keeps_punctuation
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:473
Function
test_encode_document_prompt_priority
Test that proper prompt priority is respected when multiple options are available
tests/sentence_transformer/test_model.py:1131
Function
test_encode_document_prompt_priority
Test that proper prompt priority is respected when multiple options are available
tests/sparse_encoder/test_model.py:918
Function
test_encode_document_skiplist_removes_punctuation
()
tests/multi_vector_encoder/test_model.py:324
Function
test_encode_document_varies_with_length
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:274
Function
test_encode_does_not_move_a_model_that_is_already_in_place
Encoding must skip redundant moves for every model family, including static embeddings.
tests/base/test_model.py:1122
Function
test_encode_empty_list
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:1668
Function
test_encode_forwards_module_kwargs
(method, output_value)
tests/multi_vector_encoder/test_model.py:295
Function
test_encode_fp16
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:591
Function
test_encode_ignores_a_device_for_a_device_map_model
``encode`` must honour a ``device_map`` too, not just the constructor. See #3822. ``transformers`` hands a model to accelerate only when the map
tests/base/test_model.py:1011
Function
test_encode_leaves_a_dispatched_model_where_accelerate_put_it
accelerate owns placement for a ``device_map`` model, and moving it destroys the offloaded weights.
tests/base/test_model.py:1672
Function
test_encode_moves_a_model_that_is_not_in_place
A model that spans two devices must still be moved when a device is asked for. ``model.device`` reports the underlying transformers model, so a s
tests/base/test_model.py:1158
Function
test_encode_multi_process
( stsb_bert_tiny_model: SentenceTransformer, normalize_embeddings: bool, prompt_name: str | None )
tests/sentence_transformer/test_multi_process.py:98
Function
test_encode_normalize
( stsb_bert_tiny_model: SentenceTransformer, inference_device: str, convert_to_tensor: bool )
tests/sentence_transformer/test_compute_embeddings.py:57
Function
test_encode_numpy_1d_string_array
Regression test for #3718: encoding a 1D numpy string array should produce one embedding per element.
tests/sparse_encoder/test_model.py:529
Function
test_encode_numpy_1d_string_array
Regression test for #3718: encoding a 1D numpy string array should not raise and should produce one embedding per element.
tests/base/test_model.py:1872
Function
test_encode_numpy_2d_string_array
Encoding a 2D numpy string array should match encoding the equivalent nested list.
tests/sparse_encoder/test_model.py:539
Function
test_encode_numpy_2d_string_array
Encoding a 2D numpy string array should match encoding the equivalent nested list.
tests/base/test_model.py:1882
Function
test_encode_numpy_empty
Encoding an empty string ndarray should return an empty tensor, like ``encode([])``.
tests/sparse_encoder/test_model.py:549
Function
test_encode_numpy_empty
Encoding an empty string ndarray should return an empty result, like ``encode([])``.
tests/base/test_model.py:1891
Function
test_encode_output_formats
( mve_bert_tiny_model: MultiVectorEncoder, convert_to_numpy: bool, element_type: type, )
tests/multi_vector_encoder/test_model.py:740
Function
test_encode_output_value_none_ignores_convert_flags
The convert_to_* options do not apply to raw feature dicts.
tests/multi_vector_encoder/test_model.py:943
Function
test_encode_output_value_none_keeps_modality
(model_class, modality)
tests/base/test_model.py:33
Function
test_encode_output_value_none_returns_feature_dicts
``output_value=None`` returns the raw per-input module output dicts (ST parity): every feature key a module wrote, with batch-first tensors split
tests/multi_vector_encoder/test_model.py:907
Function
test_encode_output_value_none_with_prompt
Prompts compose with ``output_value=None``: the per-item dicts carry the bookkeeping keys (mirrors the SentenceTransformer behaviour).
tests/multi_vector_encoder/test_model.py:931
Function
test_encode_output_value_rejects_unknown
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:925
Function
test_encode_per_call_processing_kwargs
Per-call ``processing_kwargs`` should be accepted by ``encode`` and reach ``preprocess``. If the kwarg were silently dropped (or rejected by enco
tests/sentence_transformer/test_model.py:1277
Function
test_encode_per_call_processing_kwargs
Per-call ``processing_kwargs`` should be accepted by ``encode`` and reach ``preprocess``. If the kwarg were silently dropped (or rejected by enco
tests/sparse_encoder/test_model.py:510
Function
test_encode_pooling_applies_to_raw_output
(mve_bert_tiny_model: MultiVectorEncoder, pooler: str)
tests/multi_vector_encoder/test_model.py:1414
Function
test_encode_pooling_compounds_and_notes_when_module_present
When a pooling is already in the pipeline AND encode() is called with a per-call ``token_pooling=``, the per-call pooling compounds on top (a supp
tests/multi_vector_encoder/test_model.py:1379
Function
test_encode_pooling_note_skipped_for_unpooled_tasks
A per-call pooling whose ``tasks`` gate skips this call must not log the compounding note, nor burn the warning_once for a later call that genuine
tests/multi_vector_encoder/test_model.py:1398
Function
test_encode_pooling_skips_queries
(mve_bert_tiny_model: MultiVectorEncoder, output_value: str | None)
tests/multi_vector_encoder/test_model.py:1445
Function
test_encode_precision_with_bfloat16_model
encode(precision=...) matches quantizing the float32 numpy output of a bfloat16 model afterwards.
tests/sentence_transformer/test_model.py:1506
Function
test_encode_quantization
( stsb_bert_tiny_model: SentenceTransformer, convert_to_tensor: bool, convert_to_numpy: bool,
tests/sentence_transformer/test_model.py:612
Function
test_encode_query
( stsb_bert_tiny_model: SentenceTransformer, sentences: str | list[str], prompt_name: str | None,
tests/sentence_transformer/test_model.py:1021
Function
test_encode_query
( splade_bert_tiny_model: SparseEncoder, sentences: str | list[str], convert_to_tensor: bool,
tests/sparse_encoder/test_model.py:823
Method
test_encode_query_and_document_calls
(self)
tests/multi_vector_encoder/test_model_card.py:64
Function
test_encode_query_document_vs_encode
Test the actual integration with encode vs encode_query/encode_document
tests/sentence_transformer/test_model.py:1233
Function
test_encode_query_empty_query_prompt_skips_default_prompt_name
An empty "query" prompt is still the prompt encode_query() selects, so ``default_prompt_name`` is not used as a fallback. This keeps ``prompts={"q
tests/sentence_transformer/test_model.py:1181
Function
test_encode_query_pads_to_expansion_length
()
tests/multi_vector_encoder/test_model.py:63
Function
test_encode_recognises_every_spelling_of_the_device_it_is_on
``"cuda"`` and ``torch.device("cpu")`` name the device the model's parameters are on. A parameter on an accelerator always reports an index, so c
tests/base/test_model.py:1134
Function
test_encode_routes_through_module_call
encode() must run the forward pass via __call__ so that model.compile() applies to inference.
tests/sentence_transformer/test_compute_embeddings.py:105
Function
test_encode_routes_through_module_call
encode() must run the forward pass via __call__ so that model.compile() applies to inference.
tests/multi_vector_encoder/test_model.py:281
Function
test_encode_routes_through_module_call
encode() must run the forward pass via __call__ so that model.compile() applies to inference.
tests/sparse_encoder/test_model.py:960
Function
test_encode_single_sentences
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_compute_embeddings.py:35
Function
test_encode_token_embeddings
Test that encode(output_value='token_embeddings') works
tests/sentence_transformer/test_compute_embeddings.py:15
Function
test_encode_torchao_quantized_cpu_cuda_round_trip
(stsb_bert_tiny_model: SentenceTransformer)
tests/base/test_model.py:1500
Function
test_encode_torchao_quantized_weights
(stsb_bert_tiny_model: SentenceTransformer, device: str | None)
tests/base/test_model.py:1455
Function
test_encode_torchao_quantized_weights_on_cuda
( stsb_bert_tiny_model: SentenceTransformer, device: str | torch.device | None )
tests/base/test_model.py:1484
Function
test_encode_truncate
( stsb_bert_tiny_model: SentenceTransformer, sentences: str | list[str], convert_to_tensor: bool,
tests/sentence_transformer/test_model.py:647
Function
test_encode_truncate_dim
(mve_bert_tiny_model: MultiVectorEncoder, method: str, output: str)
tests/multi_vector_encoder/test_model.py:1465
Function
test_encode_truncation_with_low_precision_padding
(mve_bert_tiny_model, dtype: torch.dtype, output: str)
tests/multi_vector_encoder/test_model.py:1510
Function
test_encode_tuple_sentences
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_compute_embeddings.py:83
Function
test_encode_with_composed_accelerate_hooks
(dispatched_model: SentenceTransformer)
tests/base/test_model.py:1216
Function
test_encode_with_dataset_column
Test that encode can handle a dataset column as input.
tests/sentence_transformer/test_model.py:1262
Function
test_encode_with_dataset_column
Test that encode can handle a dataset column as input.
tests/sparse_encoder/test_model.py:495
Method
test_end_is_clamped_to_the_sequence_count
(self)
tests/sentence_transformer/losses/test_gradcache.py:560
Function
test_euclidean_sim
()
tests/util/test_similarity.py:107
Function
test_euclidean_sim_sparse
Test Euclidean similarity with sparse tensors.
tests/util/test_similarity.py:214
Function
test_evaluate_calls_evaluator
evaluate() should call the evaluator and return its result.
tests/base/test_model.py:614
Function
test_evaluate_creates_output_dir
evaluate() should create output_path directory if it doesn't exist.
tests/base/test_model.py:624
Function
test_evaluator_runs_once_and_broadcasts_under_ddp
Share evaluator inference across ranks and broadcast the full-dataset metrics.
tests/base/test_trainer.py:363
Function
test_every_label_appears_at_least_twice_per_batch
(balanced_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:37
Function
test_every_mover_refuses_an_offloaded_model
``cpu()`` and ``half()`` reach ``nn.Module._apply`` without ever calling ``to``, and ``_apply`` recurses past accelerate's guard on the backbone,
tests/base/test_model.py:1703
← previous
next →
2,701–2,800 of 4,575, ranked by callers