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_router_route_mappings_basic
Test basic route_mappings functionality.
tests/base/modules/test_router.py:866
Function
test_router_route_mappings_priority
Test that route_mappings follow correct priority order.
tests/base/modules/test_router.py:973
Function
test_router_route_mappings_save_load
Test that route_mappings are saved and loaded correctly.
tests/base/modules/test_router.py:1021
Function
test_router_route_mappings_with_both_none
Test route_mappings with both None (catch-all).
tests/base/modules/test_router.py:946
Function
test_router_route_mappings_with_none_modality
Test route_mappings with None modality (any modality with specific task).
tests/base/modules/test_router.py:917
Function
test_router_route_mappings_with_none_task
Test route_mappings with None task (any task with specific modality).
tests/base/modules/test_router.py:889
Function
test_router_save_load
Test saving and loading a SentenceTransformer model with Router.
tests/base/modules/test_router.py:361
Function
test_router_save_load_preserves_shared_modules
(tmp_path: Path, share_module: bool, safe_serialization: bool)
tests/base/modules/test_router.py:400
Function
test_router_save_load_with_custom_default_route
Test saving and loading a model with custom default route.
tests/base/modules/test_router.py:423
Function
test_router_save_load_with_multiple_modules_per_route
Test saving and loading a model with multiple modules per route.
tests/base/modules/test_router.py:468
Function
test_router_save_load_without_default_route
Test saving and loading a model without a default route.
tests/base/modules/test_router.py:444
Function
test_router_save_with_safe_serialization
Test saving with safe_serialization parameter.
tests/base/modules/test_router.py:1353
Function
test_router_task_document_columns_still_merge
On an inference-free model the query routes through a different module than the documents, so the query column could never share their forward. Th
tests/sparse_encoder/losses/test_merged_forward.py:96
Function
test_router_task_not_forwarded_to_auto_model
Router.preprocess stamps features["task"] for routing, but that bookkeeping key must not reach the wrapped auto_model.forward (ONNX backends warn
tests/base/modules/test_router.py:286
Function
test_router_tokenize_with_dict_input
Test tokenize method with dictionary input.
tests/base/modules/test_router.py:1068
Function
test_router_tokenize_with_mixed_dict_raises_error
Test that tokenize raises error with mixed dictionary keys.
tests/base/modules/test_router.py:1084
Function
test_router_tokenize_with_modality
Test tokenize method with modality parameter.
tests/base/modules/test_router.py:1097
Function
test_router_tokenize_with_modality_inference_failure
Test tokenize when modality inference fails gracefully.
tests/base/modules/test_router.py:1428
Function
test_router_tokenize_with_task
Test tokenize method with task parameter.
tests/base/modules/test_router.py:1050
Function
test_router_tokenizer_property
Test the tokenizer property.
tests/base/modules/test_router.py:1121
Function
test_router_tokenizer_property_no_tokenizer
Test the tokenizer property when no tokenizer exists.
tests/base/modules/test_router.py:1130
Function
test_router_transformers_model_property
Test that the transformers_model property works with a Router.
tests/sentence_transformer/test_model.py:1384
Function
test_router_validates_all_paths_before_resolving_classes
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, path: str )
tests/base/modules/test_router.py:1550
Function
test_router_with_trainer
Test Router works correctly with a training setup using router_mapping.
tests/base/modules/test_router.py:511
Function
test_router_with_trainer_without_router_mapping
Test Router crashes with a useful ValueError when training without router_mapping.
tests/base/modules/test_router.py:553
Function
test_rrf_only_scores_retrievers_that_returned_a_document
A document returned by both retrievers must outrank documents returned by only one.
tests/sparse_encoder/test_reciprocal_rank_fusion.py:56
Function
test_rrf_ties_preserve_dense_then_sparse_input_order
(tmp_path)
tests/sparse_encoder/test_reciprocal_rank_fusion.py:163
Function
test_safe_serialization
(stsb_bert_tiny_model: SentenceTransformer, safe_serialization: bool)
tests/sentence_transformer/test_model.py:280
Function
test_safe_serialization
(reranker_bert_tiny_model: CrossEncoder, safe_serialization: bool)
tests/cross_encoder/test_model.py:395
Function
test_safetensors
( stsb_bert_tiny_model: SentenceTransformer, word_embeddings_model: SentenceTransformer, modules:
tests/sentence_transformer/test_model.py:855
Method
test_same_output_name_collision_raises
(self, documents: Dataset)
tests/util/test_dataset.py:330
Method
test_same_repository_processor_keeps_resolved_revision
(self, monkeypatch)
tests/base/modules/test_transformer.py:1757
Method
test_same_shape_different_bytes_are_distinct
(self)
tests/base/test_model_card.py:1144
Function
test_sample_coverage
Nearly all samples should be used exactly once per epoch.
tests/base/samplers/test_group_by_label_batch_sampler.py:74
Method
test_sample_first_layout_keeps_row_slicing
(self, features)
tests/sentence_transformer/losses/test_cmnrl.py:373
Function
test_sample_value_str_decoder_digest_is_stable_across_accesses
()
tests/base/samplers/test_no_duplicates_batch_sampler.py:516
Function
test_sample_value_str_digests_object_content
()
tests/base/samplers/test_no_duplicates_batch_sampler.py:544
Function
test_sample_value_str_numpy_scalars_match_python_scalars
()
tests/base/samplers/test_no_duplicates_batch_sampler.py:535
Function
test_sample_value_str_plain_values_keep_str
()
tests/base/samplers/test_no_duplicates_batch_sampler.py:527
Function
test_sample_value_str_unpicklable_falls_back_to_str
()
tests/base/samplers/test_no_duplicates_batch_sampler.py:556
Function
test_sampling_strategies
Test different sampling strategies.
tests/util/test_hard_negatives.py:401
Function
test_save_and_load
(tmp_path: Path, static_embedding: StaticEmbedding)
tests/sentence_transformer/modules/test_static_embedding.py:66
Function
test_save_and_load_round_trip
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:803
Method
test_save_and_load_roundtrip
save() then load() should produce an equivalent Transformer with identical outputs.
tests/base/modules/test_transformer.py:1867
Function
test_save_creates_expected_files
save() should create config_sentence_transformers.json and modules.json.
tests/base/test_model.py:474
Method
test_save_load
Test saving and loading the model.
tests/base/modules/transformer/test_any_to_any.py:111
Method
test_save_load
Test saving and loading the model.
tests/base/modules/transformer/test_text_generation.py:102
Method
test_save_load
Test saving and loading the model.
tests/base/modules/transformer/test_sequence_classification.py:103
Method
test_save_load
Test saving and loading the model.
tests/base/modules/transformer/test_fill_mask.py:93
Method
test_save_load
Test saving and loading the model.
tests/base/modules/transformer/test_feature_extraction.py:108
Method
test_save_load_produces_same_output
Test that a Transformer can be saved and loaded, producing identical output.
tests/base/modules/test_transformer.py:2451
Function
test_save_load_projection_round_trip
save_projection -> load_projection should preserve weights bit-for-bit.
tests/sentence_transformer/losses/test_embed_distill.py:175
Function
test_save_load_prompts
()
tests/sentence_transformer/test_model.py:396
Function
test_save_load_prompts
()
tests/sparse_encoder/test_model.py:782
Function
test_save_load_roundtrip
A model saved and re-loaded should produce the same embeddings.
tests/base/test_model.py:536
Function
test_save_load_roundtrip_cross_encoder
A CrossEncoder model saved and re-loaded should produce the same predictions.
tests/base/test_model.py:565
Function
test_save_load_roundtrip_sparse_encoder
A SparseEncoder model saved and re-loaded should produce the same embeddings.
tests/base/test_model.py:550
Function
test_save_none_path_is_noop
save(None) should return immediately without error.
tests/base/test_model.py:496
Function
test_save_pretrained_delegates_to_save
save_pretrained() should produce the same files as save().
tests/base/test_model.py:501
Function
test_save_projection_without_projection_raises
(stsb_bert_tiny_model: SentenceTransformer, tmp_path)
tests/sentence_transformer/losses/test_embed_distill.py:169
Method
test_save_raises_not_implemented
(self, tmp_path)
tests/multi_vector_encoder/modules/test_token_pooling.py:291
Function
test_save_to_hub_deprecation_warning
save_to_hub should log a deprecation warning.
tests/base/test_model.py:897
Function
test_save_to_hub_organization_conflict_raises
save_to_hub with conflicting organization in repo_id should raise ValueError.
tests/base/test_model.py:910
Function
test_save_warns_for_plain_function_activation_fn
( reranker_bert_tiny_model: CrossEncoder, tmp_path: Path, activation_fn: Callable, caplog: pyt
tests/cross_encoder/test_model.py:874
Function
test_save_with_safe_serialization_fallback
When a module's save() doesn't accept safe_serialization, fall back to save without it.
tests/base/test_model.py:515
Function
test_save_without_model_card
save(create_model_card=False) should not create README.md.
tests/base/test_model.py:508
Method
test_saved_fp32_selection_and_overrides
(self, tmp_path)
tests/cross_encoder/test_model.py:1306
Method
test_scalar_applies_to_every_column
(self)
tests/base/test_data_collator.py:196
Method
test_scalar_label_not_truncated
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:178
Function
test_scalar_quantize_float16_multi_vector_shared_ranges
(precision: str)
tests/util/test_quantization.py:163
Function
test_scalar_quantize_float16_tensor
()
tests/util/test_quantization.py:172
Function
test_scalar_quantize_float16_uses_float32_arithmetic
A nonconstant fp16 range must not collapse after bucket-step underflow or overflow.
tests/util/test_quantization.py:141
Function
test_scalar_quantize_single_embedding_without_calibration_raises
(precision: str, input_type: str)
tests/util/test_quantization.py:127
Method
test_scipy_fallback_matches_fastcluster
(self, monkeypatch: pytest.MonkeyPatch)
tests/multi_vector_encoder/modules/test_token_pooling.py:203
Function
test_score_filters
Test max_score and min_score parameters.
tests/util/test_hard_negatives.py:344
Method
test_score_label_column
(self)
tests/base/test_data_collator.py:53
Function
test_scorer_and_bound_model_round_trip
(loader, embeddings, round_trip)
tests/test_kernels.py:239
Function
test_scorer_and_pooler_select_for_actual_input_device
(loader, embeddings)
tests/test_kernels.py:961
Function
test_scores_are_float32_for_low_precision_inputs
Low-precision embeddings must still yield float32 scores (HPS).
tests/util/test_similarity.py:528
Function
test_scoring_does_not_mutate_numpy_inputs
The zero-copy view means an in-place op anywhere in a scoring path would corrupt the caller's array. Every scoring function must write into fresh
tests/util/test_tensor.py:222
Function
test_seismic_all_queries_without_matches
With no query matching anything there is no id to order by at all.
tests/sparse_encoder/test_search_engines.py:64
Function
test_seismic_orders_results_by_query
Every row carries its query id, so out-of-order rows still land on the right query.
tests/sparse_encoder/test_search_engines.py:51
Function
test_seismic_query_without_matches
A query that matches no document comes back as an empty row that carries no query id.
tests/sparse_encoder/test_search_engines.py:32
Function
test_select_max_active_dims_exceeding_dim_keeps_all_values
`max_active_dims` larger than the embedding dimensionality keeps every value, still in a new tensor.
tests/util/test_tensor.py:155
Function
test_select_max_active_dims_keeps_top_k_without_mutating_input
The top-k values by absolute value are kept with their signs, in a new tensor, leaving the input untouched.
tests/util/test_tensor.py:133
Function
test_select_max_active_dims_none_returns_input_as_is
`None` keeps all values, returning the input object itself, whether tensor or numpy array.
tests/util/test_tensor.py:146
Function
test_select_max_active_dims_rejects_non_positive
A non-positive `max_active_dims` is rejected, rather than silently returning all-zero embeddings.
tests/util/test_tensor.py:175
Function
test_select_max_active_dims_supports_single_embedding
A 1-dimensional embedding, as returned by `encode()` for a single input, is sparsified along its only axis.
tests/util/test_tensor.py:165
Method
test_selection_replacement_validation_and_defaults
(self)
tests/cross_encoder/test_model.py:1371
Function
test_self_pairs_are_excluded_when_guide_scores_tie
(loss_class, stsb_bert_tiny_model)
tests/sentence_transformer/losses/test_gist_embed.py:174
Function
test_semantic_search
Tests util.semantic_search function
tests/util/test_retrieval.py:19
Function
test_semantic_search_cos_sim_matches_generic_score_function
( corpus_chunk_size: int, query_chunk_size: int, dtype: torch.dtype )
tests/util/test_retrieval.py:81
Function
test_semantic_search_empty_corpus
(corpus)
tests/util/test_retrieval.py:74
Function
test_semantic_search_faiss_drops_padded_indices
A corpus smaller than ``top_k`` must not produce ``corpus_id: -1`` entries. FAISS pads short result sets with index -1, which would resolve to th
tests/util/test_quantization.py:384
Function
test_semantic_search_faiss_empty_corpus
An empty corpus yields empty result lists rather than phantom hits.
tests/util/test_quantization.py:409
Function
test_semantic_search_faiss_preserves_inner_product_metric
Choosing approximate search must preserve inner-product rankings and scores.
tests/util/test_quantization.py:270
Function
test_semantic_search_faiss_rejects_unsupported_precision
An unsupported ``corpus_precision`` must say so, not fall through to an unrelated error. Without validation, no index construction branch matches
tests/util/test_quantization.py:252
Function
test_semantic_search_faiss_rescores_non_byte_aligned_embeddings
Padding bits from ``np.packbits`` must not reach the rescoring.
tests/util/test_quantization.py:443
Function
test_semantic_search_faiss_returns_top_k_when_corpus_is_large_enough
The padding check must not shorten results for a corpus larger than ``top_k``.
tests/util/test_quantization.py:425
Function
test_semantic_search_input_formats
(query_format: str, corpus_format: str)
tests/util/test_retrieval.py:46
← previous
next →
4,001–4,100 of 4,575, ranked by callers