MCPcopy Create free account

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

Functions3,759 in github.com/huggingface/sentence-transformers

Functiontest_backend_no_export_crash
()
tests/sentence_transformer/test_backends.py:53
Functiontest_backend_no_export_crash
()
tests/cross_encoder/test_backends.py:59
Functiontest_backend_no_export_crash
()
tests/sparse_encoder/test_backends.py:56
Functiontest_backend_save_and_load
(backend, model_dir, torch_embeddings, tmp_path)
tests/multi_vector_encoder/test_backends.py:83
Methodtest_bad_input_type_raises
(self)
tests/multi_vector_encoder/test_token_pooling.py:70
Functiontest_bare_checkpoint_gets_no_expansion
()
tests/multi_vector_encoder/test_model.py:57
Methodtest_bare_subclass_raises_not_implemented
(self)
tests/base/modules/test_input_module.py:73
Methodtest_base_forward_via_lambda_pooling_variable_length
(self)
tests/multi_vector_encoder/test_token_pooling.py:377
Methodtest_base_hook_returns_router_mapping_entry
(self)
tests/base/test_data_collator.py:215
Functiontest_basic_functionality
Test the basic functionality with default parameters.
tests/util/test_hard_negatives.py:113
Methodtest_batch_decode_succeeds
get_frames_at with all frame indices succeeds on first try.
tests/base/test_model_card.py:1100
Functiontest_batch_guarantees
Every batch must satisfy three invariants: 1. Contains >= 2 distinct labels. 2. Every label in the batch appears >= 2 times. 3. Non-last
tests/base/samplers/test_group_by_label_batch_sampler.py:198
Methodtest_batch_n_minus_1_fallback
get_frames_at(n) fails but get_frames_at(n-1) succeeds.
tests/base/test_model_card.py:1110
Functiontest_batch_size
Test batch_size parameter.
tests/util/test_hard_negatives.py:807
Methodtest_batches
(self, messages_batch, expected)
tests/base/test_modality.py:1714
Functiontest_bert_base_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:47
Functiontest_bert_large_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:56
Functiontest_bfloat16
()
tests/cross_encoder/test_model.py:331
Functiontest_bge_reranker_max_length
()
tests/cross_encoder/test_model.py:787
Functiontest_binary_quantize_multiple_of_8_shape
For dims divisible by 8, the packed shape must equal (n, dim // 8).
tests/util/test_quantization.py:46
Functiontest_binary_quantize_non_multiple_of_8_does_not_raise
quantize_embeddings must not crash for embedding dimensions not divisible by 8.
tests/util/test_quantization.py:20
Functiontest_binary_quantize_row_independence
Each row is packed independently. An all-positive row must not bleed into an all-negative one.
tests/util/test_quantization.py:61
Methodtest_bool_column_stats
(self, stsb_bert_tiny_model: SentenceTransformer)
tests/base/test_model_card.py:819
Methodtest_both_provided_new_wins
(self, caplog)
tests/util/test_decorators.py:48
Methodtest_both_provided_new_wins
(self, caplog, old_name, new_name)
tests/util/test_decorators.py:137
Methodtest_both_provided_new_wins
(self, caplog, old_name, new_name)
tests/util/test_decorators.py:222
Methodtest_both_provided_repo_id_wins
(self, caplog)
tests/util/test_decorators.py:391
Methodtest_both_sibling_metadata_keys_hint_both_forms
(self)
tests/base/test_modality.py:275
Methodtest_budget_larger_than_the_batch
(self)
tests/sentence_transformer/losses/test_gradcache.py:279
Functiontest_cache
Test cache_folder parameter.
tests/util/test_hard_negatives.py:897
Methodtest_cache_dir_distributed
(self, caplog)
tests/util/test_decorators.py:148
Methodtest_cache_dir_does_not_override_existing
(self, caplog)
tests/util/test_decorators.py:163
Methodtest_cache_dir_none_no_warning
(self, caplog)
tests/util/test_decorators.py:174
Functiontest_cache_folder_from_env
When cache_folder is None, it should fall back to SENTENCE_TRANSFORMERS_HOME env var.
tests/base/test_model.py:401
Functiontest_cache_respects_prompt
The cache key must incorporate the prompt arguments, so a different `query_prompt` produces its own cache file rather than silently reusing embedd
tests/util/test_hard_negatives.py:918
Functiontest_cached_ce_mnrl_matches_mnrl
``mini_batch_size`` only bounds memory: the cached loss must reproduce MultipleNegativesRankingLoss's loss and gradient, whether or not it divides
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:32
Functiontest_cached_ce_mnrl_prompt_reaches_the_backward_pass
The prompt (and task) must be carried into the backward hook's re-prediction: they change the tokenization, so if the hook's bundle dropped them,
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:190
Functiontest_cached_ce_mnrl_replays_dropout_on_cuda
The backward pass must re-predict exactly the logits of the forward pass, dropout included. ``RandContext`` can only capture the RNG state of dev
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:52
Functiontest_cached_ce_mnrl_scales_with_the_outer_backward
Scaling the returned loss (gradient accumulation, fp16 loss scaling) must scale the whole gradient.
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:124
Functiontest_cached_ce_mnrl_two_forwards_before_one_backward
Each forward pass must hand its own cached gradients to its own backward hook. The cache used to live on the loss module, where a second forward p
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:95
Functiontest_cached_ce_mnrl_under_no_grad
The loss must be computable under ``torch.no_grad``, as the trainer does for the eval loss.
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:146
Functiontest_cached_ce_mnrl_with_hard_negatives
Explicit hard negatives (a third input column) triple the pair count. The cached loss must still reproduce the non-cached loss and gradient.
tests/cross_encoder/losses/test_cached_multiple_negatives_ranking.py:165
Functiontest_cached_gist_matches_gist
``mini_batch_size`` only bounds memory: for the 2- and 3-column shapes the non-cached loss supports, the cached loss must reproduce GISTEmbedLoss'
tests/sentence_transformer/losses/test_cached_gist_embed.py:218
Functiontest_cached_gist_rejects_static_embedding_behind_a_router
A Router keeps its input modules one level down, so a guard that only inspects ``model[0]`` waves a StaticEmbedding straight through, and mini-bat
tests/sentence_transformer/losses/test_cached_gist_embed.py:287
Functiontest_cached_gist_replays_dropout_in_the_backward_pass
The backward pass must re-embed exactly what the forward pass embedded, dropout included, also with this loss's bespoke ``embed_minibatch``, which
tests/sentence_transformer/losses/test_cached_gist_embed.py:252
Functiontest_cached_gist_token_budget_matches_gist
The token budget must flow through this loss's bespoke ``embed_minibatch_iter`` (which also runs the guide model) without changing the loss or gra
tests/sentence_transformer/losses/test_cached_gist_embed.py:346
Functiontest_cached_gist_two_forwards_before_one_backward
Each forward pass must hand its own cached gradients to its own backward hook. The cache used to live on the loss module, so a second forward pas
tests/sentence_transformer/losses/test_cached_gist_embed.py:181
Functiontest_cached_mnr_gather_across_devices_single_process
Single-process gather guard for the GradCache loss: the gather block must run (all_gather no-ops without a process group) and produce a finite, di
tests/multi_vector_encoder/losses/test_misc.py:445
Functiontest_cached_mnr_gradients_match_non_cached
GradCache's contract is gradient equivalence with the non-cached loss. Regression pin for the per-chunk backward normalization: it must run on the
tests/multi_vector_encoder/losses/test_misc.py:120
Functiontest_cached_mnr_handles_varlen_document_columns
Cross-column varlen through the GradCache path. Exercises the same surface as the non-cached MNRL test but with chunked embedding forward + cached
tests/multi_vector_encoder/losses/test_misc.py:68
Functiontest_cached_mnr_handles_varlen_mini_batches_within_a_column
The GradCache cat path pads each mini-batch chunk to a common ``T`` before concatenating, so native-resolution VLMs that emit different ``T`` per
tests/multi_vector_encoder/losses/test_misc.py:237
Functiontest_cached_mnr_rejects_non_positive_token_budget
The constructor runs the shared validation, so a non-positive budget fails at build time rather than producing a degenerate mini-batch split later
tests/multi_vector_encoder/losses/test_misc.py:204
Functiontest_cached_mnr_slices_flattened_vlm_inputs_grid_aware
Native-resolution VLM columns (Qwen2-VL family) flatten per-sample visual tokens into one ``pixel_values`` tensor with an ``image_grid_thw`` row p
tests/multi_vector_encoder/losses/test_misc.py:97
Functiontest_cached_mnr_stamped_task_reaches_backward_hook
The GradCache second pass re-embeds from the same feature dicts: the stamped task must govern both the no-grad forward and the with-grad re-run.
tests/multi_vector_encoder/losses/test_misc.py:331
Functiontest_cached_mnr_token_budget_matches_non_cached
``mini_batch_num_tokens`` packs mini-batches by real token count rather than by sequence count, which must not change the loss or the gradients. P
tests/multi_vector_encoder/losses/test_misc.py:163
Functiontest_cached_mnrl_matches_mnrl
Gradient caching must produce the loss and gradient of the non-cached loss, for any configuration and whether or not ``mini_batch_size`` divides (
tests/sentence_transformer/losses/test_gradcache.py:50
Functiontest_cached_splade_components_sum_to_the_total
The trainer back-propagates the sum of the returned dict, so the components must sum exactly to the gradient-carrying total even though only one e
tests/sparse_encoder/losses/test_cached_splade.py:65
Functiontest_cached_splade_inference_free_frozen_query_route
An inference-free SPLADE model routes queries through a (frozen) SparseStaticEmbedding, whose embeddings then don't require grad. The backward hoo
tests/sparse_encoder/losses/test_cached_splade.py:122
Functiontest_cached_splade_keeps_dict_base_loss_components
A dict-valued base loss must keep its own component keys in the returned dict, exactly as SpladeLoss spreads them. The separate keys are the point
tests/sparse_encoder/losses/test_cached_splade.py:201
Functiontest_cached_splade_matches_splade
``mini_batch_size`` only bounds memory: the cached loss must reproduce SpladeLoss's total loss, per-component values, and gradients, whether or no
tests/sparse_encoder/losses/test_cached_splade.py:42
Functiontest_cached_splade_replays_dropout_in_the_backward_pass
The backward pass must re-embed exactly what the forward pass embedded, dropout included, making this loss self-guarding instead of relying only o
tests/sparse_encoder/losses/test_cached_splade.py:247
Functiontest_cached_splade_token_budget_matches_splade
The token budget must reproduce SpladeLoss's per-component losses and gradients.
tests/sparse_encoder/losses/test_cached_splade.py:167
Functiontest_cached_splade_two_forwards_before_one_backward
Each forward pass must hand its own cached gradients to its own backward hook.
tests/sparse_encoder/losses/test_cached_splade.py:80
Functiontest_cached_splade_under_no_grad
The eval loss must be computable under ``torch.no_grad`` and match the training-path total.
tests/sparse_encoder/losses/test_cached_splade.py:106
Functiontest_cached_symmetric_matches_symmetric
The deprecated symmetric shim only wires ``directions`` and ``partition_mode`` into the composed loss, and that wiring has no test of its own. The
tests/sentence_transformer/losses/test_cached_mnsrl.py:19
Methodtest_cached_video_not_saved_again
Second call for same VideoDecoder returns cached path without incrementing counter.
tests/base/test_model_card.py:1276
Functiontest_can_flatten_inputs_static_model
A StaticEmbedding model (non-Transformer first module) should not support flattened inputs.
tests/base/test_model.py:961
Functiontest_can_flatten_inputs_transformer_model
_can_flatten_inputs should delegate to the Transformer module's can_flatten_inputs attribute.
tests/base/test_model.py:946
Methodtest_case_insensitive_extension
(self)
tests/base/test_modality.py:56
Methodtest_causal_padding_check_ignores_unpadded_batches
A batch with nothing to pad has no last-token problem, whatever padding_side says.
tests/base/modules/test_transformer.py:570
Methodtest_causal_right_padding_via_attribute_raises
padding_side is set to "left" on load, so reaching this means it was mutated afterwards.
tests/base/modules/test_transformer.py:531
Methodtest_causal_right_padding_via_multimodal_tokenizer_raises
A multimodal processor pads via its tokenizer and has no padding_side of its own, so the tokenizer attribute is the only one that can be wrong
tests/base/modules/test_transformer.py:583
Methodtest_causal_right_padding_via_processing_kwargs_raises
processing_kwargs overrides the attribute at call time, so the attribute alone can't be trusted: it still reads "left" here while the processo
tests/base/modules/test_transformer.py:541
Methodtest_causal_right_padding_via_processing_kwargs_raises_without_message_modality
TINY_LLAMA has a chat template, so text normally routes through apply_chat_template, which only forwards the "text" bucket. Without a "message
tests/base/modules/test_transformer.py:553
Methodtest_causal_task_left_pads_by_default
The module sets padding_side to "left" on load, so a ragged batch ends in real tokens.
tests/base/modules/test_transformer.py:524
Functiontest_cde_small_v2
()
tests/sentence_transformer/test_custom_models.py:17
Methodtest_chat_template_non_string
(self)
tests/base/test_modality.py:460
Functiontest_chat_template_receives_task_kwarg
Chat-template backbones own their query augmentation in the template (the colpali-engine suffix pattern): preprocess forwards ``task`` into ``appl
tests/multi_vector_encoder/test_model.py:75
Methodtest_chat_template_suffix_cache_is_bounded
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1391
Methodtest_chat_template_suffix_ids_captures_prompt_rendered_in_tail
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1402
Methodtest_chat_template_suffix_ids_keys_on_non_content_fields
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1423
Methodtest_chat_template_suffix_ids_mirrors_common_kwargs
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1441
Methodtest_chat_template_suffix_ids_returns_empty_without_variable_content
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1384
Methodtest_chat_template_suffix_ids_skips_uninspectable_messages
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1374
Methodtest_chat_template_suffix_ids_tolerates_unhashable_kwargs
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1366
Methodtest_chat_truncation_restore_can_be_disabled
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1183
Methodtest_chat_truncation_restore_handles_implicit_truncation
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1250
Methodtest_chat_truncation_restore_leaves_non_torch_tensors_untouched
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1210
Methodtest_chat_truncation_restore_reads_chat_template_bucket_kwargs
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1225
Methodtest_chat_truncation_restores_chat_template_suffix
(self, bert_tiny_transformer, monkeypatch)
tests/base/modules/test_transformer.py:1138
Methodtest_chat_truncation_restores_suffix_with_real_chat_template
(self)
tests/base/modules/test_transformer.py:1482
Functiontest_check_version_requirements_allows_prereleases
Development installs and torch nightlies must not trip the check.
tests/util/test_environment.py:196
Functiontest_check_version_requirements_ignores_local_version
CUDA builds report versions like 2.13.0+cu126.
tests/util/test_environment.py:203
Functiontest_check_version_requirements_includes_reason
()
tests/util/test_environment.py:189
Functiontest_check_version_requirements_invalid_installed_version_warns
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/util/test_environment.py:233
Functiontest_check_version_requirements_invalid_specifier_warns
Specifiers are validated before the installed version, so a typo can't raise for anyone.
tests/util/test_environment.py:223
Functiontest_check_version_requirements_non_dict_warns
(caplog: pytest.LogCaptureFixture)
tests/util/test_environment.py:244
Functiontest_check_version_requirements_reports_all_unmet
()
tests/util/test_environment.py:161
Functiontest_check_version_requirements_resolves_pytorch_alias
Model authors copying the "pytorch" spelling from the `__version__` block should still work.
tests/util/test_environment.py:119
Functiontest_check_version_requirements_satisfied
(requirements: dict[str, Any] | None)
tests/util/test_environment.py:147
← previousnext →2,001–2,100 of 3,759, ranked by callers