MCPcopy Create free account

hub / github.com/huggingface/sentence-transformers / functions

Functions4,575 in github.com/huggingface/sentence-transformers

Functiontest_rank_multiple_labels
(multiclass_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:192
Functiontest_rank_scores_are_floats
(reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:161
Functiontest_ranking_loss_averages_ordered_pairs_in_mixed_batch
(loss_cls)
tests/cross_encoder/losses/test_misc.py:132
Functiontest_ranking_loss_matches_pairwise_cross_entropy
(loss_cls, gap, direction, sigma, reduction_log)
tests/cross_encoder/losses/test_misc.py:263
Functiontest_ranking_loss_top_k_learns_from_relevant_document_below_cutoff
(loss_cls)
tests/cross_encoder/losses/test_misc.py:155
Functiontest_ranking_loss_without_ordered_pairs_has_zero_loss_and_gradients
(loss_cls, labels)
tests/cross_encoder/losses/test_misc.py:122
Functiontest_ranknet_extreme_scores_with_padding_match_valid_pair_cross_entropies
(reduction_log)
tests/cross_encoder/losses/test_misc.py:285
Functiontest_ranknet_top_k_keeps_pairs_with_a_document_in_top_k
()
tests/cross_encoder/losses/test_misc.py:170
Functiontest_real_query_token_slice_with_query_expansion
Fixed-width expansion renders the empty and real query to the same padded length, so the naive length diff is always 0. The slice must still selec
tests/multi_vector_encoder/test_interpretability.py:323
Functiontest_real_query_token_slice_with_query_prompt
ColBERT-style checkpoints carry their query marker in ``prompts["query"]``, which ``encode_query`` applies but ``Transformer.preprocess`` does not
tests/multi_vector_encoder/test_interpretability.py:302
Methodtest_recreate_from_path
Original decoder fails completely, fresh one from source path succeeds.
tests/base/test_model_card.py:1195
Methodtest_redundant_documents_receive_fewer_tokens
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:425
Methodtest_reference_batches_match_scipy_values_and_gradients
(self, dtype, normalize, protected)
tests/multi_vector_encoder/modules/test_token_pooling.py:135
Methodtest_reference_clustering_receives_batches
(self, monkeypatch)
tests/multi_vector_encoder/modules/test_token_pooling.py:151
Functiontest_reference_pooling_computes_distances_on_cpu
(device, pool_factor)
tests/multi_vector_encoder/modules/test_token_pooling.py:814
Functiontest_relative_margin_negative_positive_score_suppresses_closer_negative
Regression for #3819 in GISTEmbedLoss: with ``margin_strategy="relative"`` and a negative positive-pair score, a candidate more similar to the anc
tests/sentence_transformer/losses/test_gist_embed.py:146
Functiontest_relative_margin_negative_positive_score_suppresses_closer_negative
Regression for #3819 in CachedGISTEmbedLoss: with ``margin_strategy="relative"`` and a negative positive-pair score, a candidate more similar to t
tests/sentence_transformer/losses/test_cached_gist_embed.py:259
Functiontest_relative_margin_with_negative_positive_score
`relative_margin` must not keep a negative that is more similar to the anchor than the positive pair when the positive-pair score is negative (#38
tests/util/test_hard_negatives.py:1965
Methodtest_rename
(self, caplog, old_name, new_name)
tests/util/test_decorators.py:98
Methodtest_rename
(self, caplog, old_name, new_name)
tests/util/test_decorators.py:242
Functiontest_render_normalization_range_changes_colour_mapping
Passing a custom ``normalization_range`` to ``render_similarity_map_on_image`` shifts which similarity values land at which point in the viridis L
tests/multi_vector_encoder/test_interpretability.py:170
Functiontest_render_rejects_non_2d_input
()
tests/multi_vector_encoder/test_interpretability.py:113
Functiontest_render_similarity_map_returns_rgba_image
Overlay returns a new RGBA PIL Image at the source image's size. With a black background, the strongest patch picks up the mako "pale yellow-green
tests/multi_vector_encoder/test_interpretability.py:90
Methodtest_renders_plain_functions_configured_objects_and_partials
(self)
tests/util/test_misc.py:234
Functiontest_repeated_sentences_count_as_correct_matches
A repeated sentence ties with its own copy, and np.argmax takes the lowest index, so every later copy was counted wrong. Both indices are correct:
tests/sentence_transformer/evaluation/test_translation_evaluator.py:16
Functiontest_replacing_a_rejected_chat_template_takes_effect
The error names a remedy, so applying it to a loaded model has to work.
tests/cross_encoder/test_model.py:977
Methodtest_repo_id_no_warning
(self, caplog)
tests/util/test_decorators.py:431
Methodtest_repo_name_renamed_to_repo_id
(self, caplog)
tests/util/test_decorators.py:420
Methodtest_repr
(self, bert_tiny_transformer)
tests/base/modules/test_transformer.py:1977
Functiontest_reranking_evaluator
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/evaluation/test_reranking.py:9
Functiontest_reranking_evaluator_similarity
( use_batched_encoding: bool, similarity_fn_name: str, similarity_kwargs: dict, expected_score: float )
tests/sentence_transformer/evaluation/test_reranking_evaluator.py:70
Functiontest_reranking_evaluator_similarity
( use_batched_encoding: bool, similarity_fn_name: str, similarity_fct, expected_score: float )
tests/sparse_encoder/evaluation/test_reranking_evaluator.py:21
Functiontest_reranking_evaluator_string_documents
A single positive or negative document given as a string is one document, not a list of characters
tests/sentence_transformer/evaluation/test_reranking_evaluator.py:33
Functiontest_reranking_evaluator_token_pooling_and_truncate_dim
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/evaluation/test_reranking.py:27
Functiontest_resolve_model_revision_falls_back_when_resolution_fails
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/util/test_file_io.py:55
Functiontest_resolve_model_revision_is_noop_with_legacy_hub
(monkeypatch: pytest.MonkeyPatch)
tests/util/test_file_io.py:49
Functiontest_resolve_model_revision_is_quiet_when_nothing_is_cached
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/util/test_file_io.py:67
Functiontest_resolve_model_revision_raises_for_missing_repository_or_revision
( error_cls: type[Exception], monkeypatch: pytest.MonkeyPatch )
tests/util/test_file_io.py:80
Functiontest_resolve_model_revision_uses_cache_for_inaccessible_repository
( error_cls: type[Exception], monkeypatch: pytest.MonkeyPatch )
tests/util/test_file_io.py:92
Functiontest_resolve_model_revision_when_supported
(monkeypatch: pytest.MonkeyPatch)
tests/util/test_file_io.py:27
Functiontest_resolve_retrieval_model_class_from_peft_config
()
tests/multi_vector_encoder/test_model.py:191
Methodtest_restore_chat_template_suffix_handles_both_padding_sides
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1474
Methodtest_restore_chat_template_suffix_is_per_row_and_skips_multimodal
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1667
Methodtest_restore_chat_template_suffix_when_truncated_row_is_padded
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1499
Methodtest_restore_handles_float_attention_mask
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1565
Methodtest_restore_only_touches_rows_that_reached_max_length
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1537
Methodtest_restore_skipped_when_nothing_reached_max_length
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1523
Methodtest_restore_skips_tensor_batches_without_attention_mask
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1555
Methodtest_restores_on_exception
(self)
tests/base/modules/test_transformer.py:99
Methodtest_retrieval_task_warns_on_text_documents
`*ForRetrieval` processors always render text as a query: asking for document treatment on text inputs must warn instead of silently query-for
tests/base/modules/test_transformer.py:992
Methodtest_returns_modality_keyed_dict_not_processor_arg_keyed
Verify parse_inputs uses modality names as keys, not processor arg names.
tests/base/test_modality.py:954
Methodtest_returns_none_for_tokenizer
Tokenizer-only processors don't have get_attributes or attributes.
tests/base/modules/test_transformer.py:1860
Functiontest_reused_evaluator_follows_the_model_similarity
Without explicit score_functions the scoring is resolved per call, so a reused evaluator labels every model with its own similarity rather than wi
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:111
Functiontest_roberta_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:65
Functiontest_round_robin_batch_sampler
(dummy_concat_dataset: ConcatDataset)
tests/base/samplers/test_round_robin_batch_sampler.py:35
Functiontest_round_robin_batch_sampler_stops_at_advertised_length
( dataset_lengths: tuple[int, ...], drop_last: bool, expected_batches: int )
tests/base/samplers/test_round_robin_batch_sampler.py:94
Functiontest_round_robin_batch_sampler_value_error
(dummy_concat_dataset: ConcatDataset)
tests/base/samplers/test_round_robin_batch_sampler.py:67
Functiontest_round_robin_batch_sampler_with_estimated_lengths
( batch_counts: tuple[int, int], estimated_counts: tuple[int, int], expected_batches: int )
tests/base/samplers/test_round_robin_batch_sampler.py:147
Functiontest_round_robin_batch_sampler_with_no_duplicates
( values: tuple[list[int], list[int]], drop_last: bool, expected_batches: int )
tests/base/samplers/test_round_robin_batch_sampler.py:117
Methodtest_roundtrip_parse_then_convert
parse_inputs -> batch_to_message should work without key mapping issues.
tests/base/test_modality.py:1163
Functiontest_router
(model, tmp_path)
tests/test_merging.py:405
Functiontest_router_as_middle_module
Test SentenceTransformer with multiple modules including a Router.
tests/base/modules/test_router.py:755
Functiontest_router_backwards_compatibility
Test that passing task types as dictionary keys still works via backwards compatibility.
tests/base/modules/test_router.py:314
Functiontest_router_config_file_name
Test that Router has the correct config_file_name.
tests/base/modules/test_router.py:1376
Functiontest_router_config_keys
Test that Router has the correct config_keys.
tests/base/modules/test_router.py:1369
Functiontest_router_direct_lookup_by_modality
Test direct lookup by modality when not in route_mappings.
tests/base/modules/test_router.py:1217
Functiontest_router_direct_lookup_by_task
Test direct lookup by task name when not in route_mappings.
tests/base/modules/test_router.py:1202
Functiontest_router_empty_routes_raises_value_error
Test that Router raises ValueError when initialized with empty routes dictionary or None.
tests/base/modules/test_router.py:111
Functiontest_router_encode
Test encoding with Router.
tests/base/modules/test_router.py:235
Functiontest_router_for_query_document_with_explicit_none_default_route
Test that for_query_document allows explicit None for default_route.
tests/base/modules/test_router.py:847
Functiontest_router_forward_kwargs_attribute
Test that Router has the correct forward_kwargs.
tests/base/modules/test_router.py:1381
Functiontest_router_forward_kwargs_overwrite_features
Test that task/modality passed as kwargs to forward take precedence over values in features dict.
tests/base/modules/test_router.py:1469
Functiontest_router_forward_unsorted_tuple_modality_from_features
Test that a tuple modality in features is normalized (sorted) before route resolution.
tests/base/modules/test_router.py:1497
Functiontest_router_forward_with_modality_in_features
Test that forward method can get modality from features dict.
tests/base/modules/test_router.py:1275
Functiontest_router_forward_with_task_in_features
Test that forward method can get task from features dict.
tests/base/modules/test_router.py:1256
Functiontest_router_forwards_on_model_ready_to_routed_modules
Routed modules are invisible to the model's top-level module list, so the Router forwards the hook. Without it they never resolve their model-depe
tests/base/modules/test_router.py:1519
Functiontest_router_forwards_task_to_sub_module_preprocess
The route is resolved from ``task``, but input modules also read it to apply per-task preprocessing (e.g. a Transformer's ``query_length`` / ``doc
tests/base/modules/test_router.py:1532
Functiontest_router_get_embedding_dimension
Test get_embedding_dimension method.
tests/base/modules/test_router.py:1139
Functiontest_router_get_routes_string
Test _get_routes_string method for error messages.
tests/base/modules/test_router.py:1232
Functiontest_router_init_basic
Test basic initialization of Router.
tests/base/modules/test_router.py:150
Functiontest_router_init_invalid_default_route
Test initialization with invalid default route raises ValueError.
tests/base/modules/test_router.py:201
Functiontest_router_init_invalid_route_mapping
Test initialization with route_mappings pointing to non-existent routes raises ValueError.
tests/base/modules/test_router.py:221
Functiontest_router_init_multiple_modules_per_route
Test initialization with multiple modules per route.
tests/base/modules/test_router.py:209
Functiontest_router_init_with_default_route
Test initialization with explicit default route.
tests/base/modules/test_router.py:181
Functiontest_router_init_without_default_route
Test initialization without default route and allow_empty_key=False.
tests/base/modules/test_router.py:191
Functiontest_router_is_alias_for_asym
Test that Router is an alias for Asym.
tests/base/modules/test_router.py:308
Functiontest_router_load_forwards_trust_remote_code
Router.load() forwards trust_remote_code, revision, and Hub auth/cache kwargs to import_module_class so repository-local custom child class refs (
tests/base/modules/test_router.py:718
Functiontest_router_load_with_config
Test that Router can be loaded from a saved directory with config file.
tests/base/modules/test_router.py:672
Functiontest_router_load_with_dtype_casts_routed_modules
(stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path)
tests/base/modules/test_router.py:411
Functiontest_router_max_seq_length_edges
()
tests/base/modules/test_router.py:117
Functiontest_router_max_seq_length_setter_no_modules_warning
Test that setting max_seq_length logs a warning when no modules have it.
tests/base/modules/test_router.py:1411
Functiontest_router_max_seq_length_warning
Test that max_seq_length logs a warning when different values exist.
tests/base/modules/test_router.py:1387
Functiontest_router_modalities
Test that Router.modalities returns the union of modalities from all sub-module input modules.
tests/base/modules/test_router.py:1441
Functiontest_router_module_forward_kwargs
Test that Router's forward method passes kwargs correctly to sub-modules.
tests/base/modules/test_router.py:585
Functiontest_router_multimodal_modality_tuple
Test routing with tuple modality (e.g., multimodal).
tests/base/modules/test_router.py:1297
Functiontest_router_multimodal_modality_tuple_ordering
Tuple modality keys in route_mappings and inferred from inputs are both sorted, so insertion-order variations should resolve to the same route.
tests/base/modules/test_router.py:1321
Functiontest_router_preprocess_empty_inputs
preprocess with an empty list should not crash on the backwards-compat inputs[0] check.
tests/base/modules/test_router.py:1111
Functiontest_router_resolve_route_error_messages
Test error messages from route resolution.
tests/base/modules/test_router.py:1164
Functiontest_router_resolve_route_training_mode_error
Test error message in training mode when no route can be determined.
tests/base/modules/test_router.py:1184
Functiontest_router_roundtrip_with_nested_route_name
(tmp_path: Path)
tests/base/modules/test_router.py:1580
← previousnext →3,901–4,000 of 4,575, ranked by callers