MCPcopy Create free account

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

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

Methodtest_pipe_escaped
(self)
tests/base/test_model_card.py:251
Functiontest_pipeline_and_per_call_pooling_keep_pooler_configuration
(loader)
tests/test_kernels.py:487
Functiontest_pipeline_ward_inheritance_preserves_training_and_checkpoint_behavior
(loader, tmp_path)
tests/test_kernels.py:661
Functiontest_placement_dtype_ignores_outer_parameters
()
tests/base/test_model.py:1602
Functiontest_placement_hook_is_cached
(hooked: bool)
tests/base/test_model.py:1227
Methodtest_plain_string
(self)
tests/base/test_model_card.py:208
Methodtest_plain_text
(self)
tests/base/test_modality.py:139
Methodtest_plain_text_not_audio
(self)
tests/base/test_modality.py:111
Methodtest_plain_text_not_image
(self)
tests/base/test_modality.py:39
Methodtest_plain_text_not_video
(self)
tests/base/test_modality.py:84
Functiontest_plistmle_default_weights_for_short_lists
()
tests/cross_encoder/losses/test_misc.py:185
Functiontest_plistmle_long_lists_match_sequential_cross_entropy
(num_docs, respect_input_order)
tests/cross_encoder/losses/test_misc.py:193
Methodtest_plural_keys_rejected_without_mutating_input
(self, plural)
tests/base/test_modality.py:133
Methodtest_plural_naming
(self, documents: Dataset, input_col: str, output_col: str)
tests/util/test_dataset.py:116
Methodtest_pool_factor_and_max_tokens_are_mutually_exclusive
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:556
Methodtest_pool_factor_must_be_positive
(self, bad: float)
tests/multi_vector_encoder/modules/test_token_pooling.py:548
Methodtest_pool_matches_scipy_clustering
(self, normalize_embeddings: bool)
tests/multi_vector_encoder/modules/test_token_pooling.py:124
Functiontest_pool_takes_placement_over_from_an_undispatched_device_map
The pool guard must ask about accelerate hooks, not about the ``device_map`` itself. ``device_map="auto"`` on a model that fits attaches no hooks
tests/base/test_model.py:1055
Methodtest_pooled_rows_are_cluster_means
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:250
Functiontest_pooler_parameters_and_outer_gradient_scaling
(build_inner, trainable: bool)
tests/multi_vector_encoder/losses/test_token_pooling.py:299
Functiontest_pooling_cls_left_padded_finds_first_real_token
For left-padded inputs (decoder-style models), the first real token is the first 1 in the attention mask, not position 0. Reproduces #3208.
tests/sentence_transformer/modules/test_pooling.py:250
Functiontest_pooling_cls_right_padded_uses_position_zero
For right-padded inputs, the first real token is at position 0.
tests/sentence_transformer/modules/test_pooling.py:238
Functiontest_pooling_cls_uses_cls_token_embeddings
()
tests/sentence_transformer/modules/test_pooling.py:173
Functiontest_pooling_config_round_trip
Verify config survives a save/load round-trip through JSON.
tests/sentence_transformer/modules/test_pooling.py:690
Functiontest_pooling_encode_and_saved_pipeline
(tmp_path, normalize_embeddings: bool | None)
tests/multi_vector_encoder/modules/test_token_pooling.py:776
Functiontest_pooling_exact_values
Verify each pooling mode produces the expected exact values.
tests/sentence_transformer/modules/test_pooling.py:511
Functiontest_pooling_excludes_prompt_tokens_directly
(padding_side: str, prompt_length_value)
tests/sentence_transformer/modules/test_pooling.py:393
Functiontest_pooling_excludes_prompt_tokens_for_padded_and_flattened_inputs
( pooling_mode: str | tuple[str, ...], flattened: bool, padding_side: str )
tests/sentence_transformer/modules/test_pooling.py:606
Functiontest_pooling_flattened_cls_falls_back_when_prompt_covers_sequence
( prompt_length: int, expected: list[list[float]], device: str )
tests/sentence_transformer/modules/test_pooling.py:223
Functiontest_pooling_flattened_cls_uses_cls_token_embeddings
()
tests/sentence_transformer/modules/test_pooling.py:195
Functiontest_pooling_flattened_live_flash_attention
End-to-end test comparing flattened (flash attention) vs padded pooling on a real model. Loads a real SentenceTransformer with flash_attention_2,
tests/sentence_transformer/modules/test_pooling.py:817
Functiontest_pooling_forward_all_strategies
(pooling_mode: str)
tests/sentence_transformer/modules/test_pooling.py:109
Functiontest_pooling_gradient_flow
Verify that gradients flow through every pooling mode in both padded and flattened paths.
tests/sentence_transformer/modules/test_pooling.py:148
Functiontest_pooling_invalid_mode_raises
()
tests/sentence_transformer/modules/test_pooling.py:809
Functiontest_pooling_lasttoken_all_padding_returns_zero_vector
()
tests/sentence_transformer/modules/test_pooling.py:370
Functiontest_pooling_lasttoken_finds_last_attended_token
()
tests/sentence_transformer/modules/test_pooling.py:343
Functiontest_pooling_legacy_bool_kwargs_with_deprecation_warning
Legacy ``pooling_mode_*`` bool kwargs should still work but emit a FutureWarning.
tests/sentence_transformer/modules/test_pooling.py:634
Functiontest_pooling_legacy_config_conversion
Verify that old-style saved configs are silently converted when loading.
tests/sentence_transformer/modules/test_pooling.py:658
Functiontest_pooling_legacy_config_conversion_multi_mode
Verify legacy config with multiple active modes converts to a tuple.
tests/sentence_transformer/modules/test_pooling.py:674
Functiontest_pooling_legacy_multiple_bool_kwargs
Multiple legacy bool kwargs should produce a tuple of modes in forward order.
tests/sentence_transformer/modules/test_pooling.py:645
Functiontest_pooling_long_sequences_preserve_precision
( pooling_mode: str, dtype: torch.dtype, prompt_length: int, flattened: bool, device: str )
tests/sentence_transformer/modules/test_pooling.py:706
Functiontest_pooling_max_respects_attention_mask
()
tests/sentence_transformer/modules/test_pooling.py:266
Functiontest_pooling_mean_and_mean_sqrt_len_tokens
(dtype: torch.dtype)
tests/sentence_transformer/modules/test_pooling.py:287
Functiontest_pooling_mean_external_normalizer_dtype
( dtype: torch.dtype, weight_dtype: torch.dtype, empty_prompt: bool, pooling_mode: str, device: str )
tests/sentence_transformer/modules/test_pooling.py:785
Functiontest_pooling_multi_mode
Verify multiple pooling modes are concatenated in the correct order.
tests/sentence_transformer/modules/test_pooling.py:537
Functiontest_pooling_name_suffix
()
tests/multi_vector_encoder/evaluation/test_utils.py:6
Functiontest_pooling_names_stay_short_with_non_default_settings
(kwargs)
tests/multi_vector_encoder/evaluation/test_utils.py:26
Functiontest_pooling_prompt_exclusion_is_idempotent
The wrapper losses re-embed the dicts they were given, e.g. once per layer in AdaptiveLayerLoss. Narrowing ``attention_mask`` in place would hide
tests/sentence_transformer/modules/test_pooling.py:84
Functiontest_pooling_respects_include_prompt
``include_prompt=False`` drops the prompt tokens from the pooling average and nothing else: the encoder still attends over them and the reported m
tests/sentence_transformer/modules/test_pooling.py:34
Methodtest_pooling_supports_low_precision_dtypes
(self, dtype: torch.dtype, normalize_embeddings: bool)
tests/multi_vector_encoder/modules/test_token_pooling.py:191
Functiontest_pooling_weightedmean_low_precision
(dtype: torch.dtype, flattened: bool, scenario: str, device: str)
tests/sentence_transformer/modules/test_pooling.py:744
Functiontest_pooling_weightedmean_respects_attention_mask
()
tests/sentence_transformer/modules/test_pooling.py:321
Methodtest_positional_args
(self, caplog, num_args)
tests/util/test_decorators.py:297
Methodtest_positional_args_adjusted
When >= 2 positional args are passed, a None is inserted at position 2 for the `token` arg.
tests/util/test_decorators.py:452
Methodtest_positional_does_not_override_kwarg
(self, caplog)
tests/util/test_decorators.py:334
Methodtest_positionally_bound_partials_lose_their_settings
Known limitation: only ``keywords`` are rendered, so a positional binding is invisible in the model card. Harmless for the scoring signature,
tests/util/test_misc.py:249
Functiontest_positive_mask_protects_ce_target_column
Drive the real loss and assert it protects exactly the CE-target column. We capture the (masked) score matrix the loss feeds to cross-entropy and
tests/sentence_transformer/losses/test_gist_embed.py:82
Functiontest_positive_mask_protects_ce_target_column
Drive the real loss and assert it protects exactly the CE-target column in every minibatch. We capture each minibatch's (masked) score matrix and
tests/sentence_transformer/losses/test_cached_gist_embed.py:194
Methodtest_precision_gradients_and_parameter_identity
(self, dtype, device)
tests/cross_encoder/test_model.py:1333
Functiontest_predict_applies_chat_template_that_only_echoes_the_role
A template that carries unknown roles through must keep working, not raise. Pass-through ChatML templates such as SmolLM2's emit ``message['role'
tests/cross_encoder/test_model.py:1057
Functiontest_predict_applies_chat_template_with_pair_roles
A template that does reference the ``query``/``document`` roles must still be applied.
tests/cross_encoder/test_model.py:1042
Functiontest_predict_batch_size_1
Regression test: batch_size=1 with num_labels=1 used to fail because squeeze produced a 0-d tensor. Some models (e.g. jinaai/jina-reranker-m0) re
tests/cross_encoder/test_model.py:327
Functiontest_predict_low_precision_logits_upcast_to_float32
The activation over cross-encoder logits must run in float32 for low-precision models (HPS). Applying sigmoid/softmax to float16/bfloat16 logits
tests/cross_encoder/test_model.py:243
Functiontest_predict_multi_process
( reranker_bert_tiny_model: CrossEncoder, convert_to_tensor: bool, apply_softmax: bool )
tests/cross_encoder/test_multi_process.py:17
Functiontest_predict_numpy_1d_pair
Predicting on a 1D numpy string array (a single pair) should match the tuple equivalent and return a scalar score. Exercises the singular-branch .
tests/cross_encoder/test_model.py:307
Functiontest_predict_numpy_2d_pairs
Predicting on a 2D numpy string array should match predicting on the equivalent nested list.
tests/cross_encoder/test_model.py:318
Functiontest_predict_numpy_empty
Predicting on an empty string ndarray should return an empty array, like ``predict([])``.
tests/cross_encoder/test_model.py:299
Functiontest_predict_output_types
( reranker_bert_tiny_model: CrossEncoder, convert_to_tensor: bool, convert_to_numpy: bool )
tests/cross_encoder/test_model.py:374
Functiontest_predict_per_call_processing_kwargs
Per-call ``processing_kwargs`` should be accepted by ``predict`` and reach ``preprocess``. If the kwarg were silently dropped, truncated and full
tests/cross_encoder/test_model.py:943
Functiontest_predict_raises_on_chat_template_without_pair_roles
A chat template that drops the pair roles must be reported, not worked around. Backbones such as the Qwen3 instruct models carry a template that
tests/cross_encoder/test_model.py:1007
Functiontest_predict_raises_on_mixed_batch_containing_a_pair
One pair in a batch is enough, its content would be dropped just the same.
tests/cross_encoder/test_model.py:1032
Functiontest_predict_rank_args_decorator
( reranker_bert_tiny_model: CrossEncoder, monkeypatch: pytest.MonkeyPatch, caplog, in_kwargs: dict, out_kw
tests/cross_encoder/test_model.py:720
Functiontest_predict_routes_through_module_call
predict() must run the forward pass via __call__ so that model.compile() applies to inference.
tests/cross_encoder/test_model.py:1256
Functiontest_predict_single_input
(model_fixture: str, request: FixtureRequest)
tests/cross_encoder/test_model.py:267
Functiontest_predict_softmax
(multiclass_bert_tiny_model: CrossEncoder, caplog)
tests/cross_encoder/test_model.py:211
Functiontest_predict_softmax_single_label
(reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:229
Functiontest_predict_with_dataset_column
Test that predict can handle a dataset column as input.
tests/cross_encoder/test_model.py:921
Functiontest_predict_with_falsey_activation_override
(reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:759
Functiontest_prefix_added_token_repaired_to_single_piece
()
tests/multi_vector_encoder/test_model.py:243
Methodtest_preprocess
(self)
tests/base/test_model.py:82
Methodtest_preprocess_accepts_prompt
(self)
tests/base/test_model.py:94
Methodtest_preprocess_empty_inputs
preprocess with an empty list should return an empty dict without raising.
tests/base/modules/test_transformer.py:578
Functiontest_preprocess_modality_error_messages
preprocess() should raise a clear, accurate ValueError for each unsupported-modality scenario. The model's supported modalities are simulated via
tests/base/test_model.py:241
Functiontest_preprocess_passes_supported_modality
preprocess() should succeed with text inputs on a text-only model.
tests/base/test_model.py:268
Methodtest_preprocess_per_call_merges_with_instance_processing_kwargs
Per-call values override matching instance values. Non-overridden settings are preserved.
tests/base/modules/test_transformer.py:625
Methodtest_preprocess_per_call_processing_kwargs_common_override
Per-call processing_kwargs 'common' should override return_tensors for that call only.
tests/base/modules/test_transformer.py:614
Methodtest_preprocess_per_call_processing_kwargs_does_not_mutate_instance
Per-call overrides must not leak into self.processing_kwargs.
tests/base/modules/test_transformer.py:647
Methodtest_preprocess_per_call_processing_kwargs_text_override
Per-call processing_kwargs should override defaults for that call only.
tests/base/modules/test_transformer.py:602
Methodtest_preprocess_per_call_processing_kwargs_unknown_keys_warning
Unknown top-level keys in per-call processing_kwargs should emit a warning.
tests/base/modules/test_transformer.py:638
Methodtest_preprocess_processing_kwargs_common_override
processing_kwargs 'common' should override common_kwargs like return_tensors.
tests/base/modules/test_transformer.py:593
Methodtest_preprocess_processing_kwargs_text_override
processing_kwargs should override default text preprocessing kwargs.
tests/base/modules/test_transformer.py:583
Functiontest_preprocess_raises_on_non_text_pair_without_pair_roles
Non-text pairs reach the roles by a different route, and are dropped just the same.
tests/cross_encoder/test_model.py:993
Functiontest_preprocess_skips_modality_check_for_empty_inputs
preprocess() should skip the modality check when inputs is empty.
tests/base/test_model.py:275
Methodtest_preprocess_subclass_with_prompt
(self)
tests/base/modules/test_input_module.py:68
Methodtest_preprocess_subclass_works_without_warning
(self, caplog)
tests/base/modules/test_input_module.py:61
Functiontest_preprocess_unsupported_modality_uses_shared_error
A text-only Transformer module rejects unsupported modalities with the same module-scoped guidance that BaseModel.preprocess produces (both via ``
tests/base/modules/test_transformer.py:69
Methodtest_preprocess_with_text_prompt
preprocess should incorporate a text prompt and set prompt_length.
tests/base/modules/test_transformer.py:566
Methodtest_preprocess_without_prompt
preprocess without a prompt should not include prompt_length.
tests/base/modules/test_transformer.py:573
Methodtest_preserves_positional_args
(self)
tests/util/test_decorators.py:69
Functiontest_pretrained
( model_name: str, expected_score: float, stsb_dataset_dict: DatasetDict, cache_dir: str | None = None )
tests/sentence_transformer/test_pretrained_stsb.py:144
← previousnext →3,701–3,800 of 4,575, ranked by callers