MCPcopy Create free account

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

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

Methodtest_chat_truncation_restores_suffix_with_real_chat_template
(self)
tests/base/modules/test_transformer.py:1692
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
Functiontest_check_version_requirements_unmet
()
tests/util/test_environment.py:151
Functiontest_check_version_requirements_unmet_python_excluded_but_others_listed
()
tests/util/test_environment.py:180
Functiontest_check_version_requirements_unmet_python_omits_pip_install
`pip install "python>=99.0"` isn't a command anyone can run.
tests/util/test_environment.py:170
Functiontest_checkpointing_arguments
(args_class, kwargs, expected)
tests/base/test_training_args.py:40
Functiontest_checkpointing_arguments_copy
(args_class, copy_method)
tests/base/test_training_args.py:115
Functiontest_checkpointing_arguments_round_trip
(name, copy_method)
tests/base/test_training_args.py:94
Functiontest_checkpointing_cli_arguments
(name, value, expected)
tests/base/test_training_args.py:50
Functiontest_checkpointing_enable
(name: str, model_fixture: str, request: pytest.FixtureRequest)
tests/base/test_model.py:933
Functiontest_checkpointing_enable_options
(name: str, module_api: str, checkpointing_kwargs: dict | None)
tests/base/test_model.py:942
Functiontest_checkpointing_enable_skips_unsupported_wrapper
(name: str, caplog: pytest.LogCaptureFixture)
tests/base/test_model.py:959
Functiontest_checkpointing_kwargs
(name, value)
tests/base/test_training_args.py:72
Functiontest_checkpointing_kwargs_prefer_new_name
(value)
tests/base/test_training_args.py:80
Functiontest_chunk_ranges_budget_packing
Greedy packing keeps each chunk's per_item_token * width * count under the budget, isolates a long outlier in its own chunk, and never emits an em
tests/util/test_similarity.py:719
Methodtest_classifier_dropout
(self, caplog)
tests/util/test_decorators.py:275
Functiontest_classifier_dropout_default_value
(reranker_bert_tiny_model: CrossEncoder)
tests/cross_encoder/test_model.py:64
Functiontest_classifier_dropout_is_set
(reranker_bert_tiny_model: CrossEncoder, tmp_path: Path, kwargs: dict)
tests/cross_encoder/test_model.py:55
Methodtest_classifier_dropout_merges_into_existing_config_kwargs
(self, caplog)
tests/util/test_decorators.py:286
Functiontest_clear_placement_cache_realigns_modules_added_after_inference
()
tests/base/test_model.py:1280
Functiontest_clear_placement_cache_refreshes_added_replaced_and_removed_hooks
()
tests/base/test_model.py:1250
Functiontest_clip
()
tests/sentence_transformer/test_model.py:1000
Functiontest_cmnrl_attributes_and_config_back_compat
CachedMultipleNegativesRankingLoss composes an inner MultipleNegativesRankingLoss, but the documented attributes and ``get_config_dict`` keys must
tests/sentence_transformer/losses/test_cmnrl.py:428
Functiontest_cmnrl_gather_across_devices_offset
The ``gather_across_devices`` path has no other test. Simulate world=2/rank=1 by having ``all_gather_with_grad`` return ``[local; local]``: the ga
tests/sentence_transformer/losses/test_cmnrl.py:575
Functiontest_cmnrl_hyperparameters_stay_assignable
The delegating properties must keep supporting assignment, as the plain attributes did before the rebase. That includes assigning an ``nn.Module``
tests/sentence_transformer/losses/test_cmnrl.py:514
Functiontest_cmnrl_matryoshka
``MatryoshkaLoss(CachedMultipleNegativesRankingLoss(...))``, the combination the visual document retrieval example ships with, must match ``Matryo
tests/sentence_transformer/losses/test_cmnrl.py:476
Functiontest_cmnrl_same_grad
( train_samples_mnrl: list[tuple[str, str, str]], train_samples_cmnrl: list[tuple[str, str, str]],
tests/sentence_transformer/losses/test_cmnrl.py:91
Functiontest_cmnrl_token_budget_matches_mnrl
With ``mini_batch_num_tokens``, the embedding passes pack by token count, but the loss and gradient must still exactly match MultipleNegativesRank
tests/sentence_transformer/losses/test_cmnrl.py:547
Functiontest_cnn_save_load_preserves_strides
(tmp_path: Path)
tests/sentence_transformer/modules/test_cnn.py:11
Functiontest_cnn_sentence_embeddings_are_invariant_to_padding
(padding_side, padding_value, kernel_sizes)
tests/sentence_transformer/modules/test_cnn.py:27
Functiontest_cnn_without_attention_mask_preserves_unmasked_convolution
()
tests/sentence_transformer/modules/test_cnn.py:47
Functiontest_colbert_kd_scores_are_the_block_diagonal_of_the_matrix
KD scores are each query's own document group, the query-major block diagonal of the full matrix. Split out of the bfloat16 test below so it keeps
tests/multi_vector_encoder/test_model.py:1065
Functiontest_colbert_scorers_match_the_maxsim_keyword_surface
Every colbert scorer takes and forwards chunk_elements and length_normalize, so one kwargs dict works across the family and the default training p
tests/multi_vector_encoder/test_model.py:1963
Functiontest_colbert_scores_keep_float32_through_delegation
The losses' default similarity_fct surface must keep maxsim's float32 scores, also under a future fused reimplementation.
tests/multi_vector_encoder/test_model.py:1083
Functiontest_colbert_scoring_callable_query_major
()
tests/multi_vector_encoder/test_model.py:1765
Functiontest_collator_assigns_task_by_position_regardless_of_name
The collator assigns ``task`` by column POSITION (column 0 = query, the rest = document) to match the losses, which score positionally. Column nam
tests/multi_vector_encoder/test_trainer.py:180
Functiontest_collator_pads_to_batch_longest_not_model_max_length
A fresh MVE has ``document_length=None``. Before the fix the collator forced ``padding="max_length"`` which silently padded every batch to ``token
tests/multi_vector_encoder/test_trainer.py:118
Functiontest_collator_router_mapping_overrides_positional_default
``router_mapping`` overrides the positional default per column.
tests/multi_vector_encoder/test_trainer.py:204
Functiontest_collator_stamps_resolved_task_into_batch
The collator stamps the task each column was tokenized with as ``{column}_task`` so the losses re-run the model under the same task (instead of re
tests/multi_vector_encoder/test_trainer.py:224
Functiontest_collator_within_column_rectangular_across_ragged_columns
Within each column every row shares ``T`` (the loss reshapes per-column on ``dim=0``), but columns are independently padded to their own batch-lon
tests/multi_vector_encoder/test_trainer.py:149
Functiontest_column_labels_match_flat_labels
(loss_class, num_columns, labels)
tests/sentence_transformer/losses/test_misc.py:51
Functiontest_column_labels_match_flat_labels
(reranker_bert_tiny_model_v54: CrossEncoder, loss_class)
tests/cross_encoder/losses/test_misc.py:312
Functiontest_column_names
Test specifying custom column names.
tests/util/test_hard_negatives.py:129
Methodtest_combined_modality_builds_dicts
A model with tuple modality ("image", "text") builds multimodal dicts from text+image columns.
tests/base/test_model_card.py:590
Methodtest_combined_only_model
A Kosmos-like model with only ("image", "text") still builds combined dicts.
tests/base/test_model_card.py:656
Functiontest_community_detection_accepts_1d_embedding
(as_numpy, min_community_size, expected)
tests/util/test_retrieval.py:386
Functiontest_community_detection_all_points_in_one_community
Test case where all points form a single community due to a low threshold.
tests/util/test_retrieval.py:272
Functiontest_community_detection_empty_input
(as_numpy)
tests/util/test_retrieval.py:395
Functiontest_community_detection_gpu_support
Test case for GPU support (if available).
tests/util/test_retrieval.py:459
Functiontest_community_detection_large_batch_size
Test case with a large dataset and batching.
tests/util/test_retrieval.py:421
Functiontest_community_detection_min_community_size_equals_input
A dataset exactly as large as the minimum community size can still form a community.
tests/util/test_retrieval.py:313
Functiontest_community_detection_min_community_size_filtering
Test case where communities are filtered based on minimum size.
tests/util/test_retrieval.py:288
Functiontest_community_detection_min_community_size_larger_than_input
A dataset smaller than the minimum community size cannot form a community.
tests/util/test_retrieval.py:306
Functiontest_community_detection_mixed_community_sizes
(device: str, batch_size: int)
tests/util/test_retrieval.py:486
Functiontest_community_detection_no_communities_high_threshold
Test case where no communities are found due to a high threshold.
tests/util/test_retrieval.py:258
Functiontest_community_detection_numpy_input
Test case where input is a numpy array instead of a torch tensor.
tests/util/test_retrieval.py:403
Functiontest_community_detection_overlapping_communities
Test case with overlapping communities (resolved by the function).
tests/util/test_retrieval.py:323
Functiontest_community_detection_preserves_centers
(angles, dtype, expected, batch_size, device)
tests/util/test_retrieval.py:371
Functiontest_community_detection_similarities_equal_to_threshold
Members whose similarity equals the threshold exactly must not be truncated. The candidate window grew only while the smallest candidate was stri
tests/util/test_retrieval.py:440
Functiontest_community_detection_two_clear_communities
Test case with two clear communities.
tests/util/test_retrieval.py:238
Functiontest_compiled_scoring_uses_reference
(loader, embeddings)
tests/test_kernels.py:403
Functiontest_complementary_retrievers
()
tests/sparse_encoder/test_reciprocal_rank_fusion.py:120
Methodtest_compound_modality_expanded
A dict with multiple modalities (e.g. text+image) should be expanded into separate content items, not wrapped as a single compound-typed item.
tests/base/test_modality.py:1402
Methodtest_compound_modality_preserves_user_order_in_both_roles
(self, modalities)
tests/base/test_modality.py:1336
Functiontest_compute_gor_is_finite_for_every_batch_size
A batch of one has no off-diagonal pairs, which used to divide by zero and return nan.
tests/sentence_transformer/losses/test_global_orthogonal_regularization.py:24
Functiontest_compute_gor_matches_the_off_diagonal_definition
Guarding the batch-of-one case must leave batches that do have pairs untouched.
tests/sentence_transformer/losses/test_global_orthogonal_regularization.py:36
Functiontest_config_and_model_none_without_transformer
``.config`` and ``.model`` must degrade to ``None`` when the module stack has no underlying HuggingFace Transformer rather than raising AttributeE
tests/cross_encoder/test_model.py:502
Methodtest_config_args_deprecated
(self, caplog)
tests/base/modules/test_transformer.py:500
Functiontest_config_delegates_to_underlying_transformers_model
`model.config` should return the underlying transformers PretrainedConfig so integrations like Deepspeed and transformers.Trainer can read `hidden
tests/base/test_model.py:288
Functiontest_config_is_settable
Assigning ``model.config`` should not raise and should round-trip through the underlying transformers model (fixes optimum ONNX export regression
tests/base/test_model.py:306
Methodtest_config_object_override
(self)
tests/base/modules/test_transformer.py:355
Functiontest_config_returns_none_when_no_underlying_transformers_model
If the model has no underlying transformers PreTrainedModel (e.g. StaticEmbedding-only), `model.config` returns `None` instead of raising.
tests/base/test_model.py:297
Methodtest_config_round_trip
(self, tmp_path)
tests/multi_vector_encoder/modules/test_token_pooling.py:416
Functiontest_config_setter_on_model_without_underlying_transformers_model
Assigning ``model.config`` on a StaticEmbedding-only model (no underlying transformers model) should be silently ignored, i.e. ``model.config`` ke
tests/base/test_model.py:318
Methodtest_conflicting_sampling_rates_raise
https://github.com/huggingface/sentence-transformers/issues/3874
tests/base/test_modality.py:715
Methodtest_consistent_hash
The same encoded source produces the same hash.
tests/base/test_model_card.py:1127
Methodtest_contains_expected_modalities
(self)
tests/base/test_modality.py:392
Methodtest_content_not_str_or_list
Non-string, non-list content is treated as non-text.
tests/base/test_modality.py:1554
Functiontest_contrastive_loss_does_not_warn_for_binary_labels
()
tests/sentence_transformer/losses/test_contrastive.py:44
Functiontest_contrastive_loss_only_checks_the_first_batch
()
tests/sentence_transformer/losses/test_contrastive.py:56
Functiontest_contrastive_loss_warns_once_for_non_binary_labels
()
tests/sentence_transformer/losses/test_contrastive.py:27
Functiontest_contrastive_tension_column_and_inferred_labels
(batch_size)
tests/sentence_transformer/losses/test_contrastive_tension.py:47
Functiontest_contrastive_tension_keeps_final_positive_pair
()
tests/sentence_transformer/losses/test_contrastive_tension.py:39
Functiontest_contrastive_tension_length_matches_batches
(sentence_count, batch_size, ratio, expected_batches)
tests/sentence_transformer/losses/test_contrastive_tension.py:26
Functiontest_contrastive_tension_multiple_labels_per_row_raise
(batch_size)
tests/sentence_transformer/losses/test_contrastive_tension.py:60
Functiontest_conversion_from_sentence_transformer_keeps_prompts_and_similarity
The SentenceTransformer branch reuses the saved modules and appends a SparseAutoEncoder (CSR), so the source's prompts and similarity stay meaning
tests/sparse_encoder/test_model.py:1010
Functiontest_conversion_ignores_prompts_from_sparse_save
Converting a SparseEncoder (or CrossEncoder) save rebuilds the default MVE modules, so the source's prompts and default_prompt_name are not inheri
tests/multi_vector_encoder/test_model.py:954
Functiontest_conversion_ignores_source_prompts_and_default_prompt_name
Converting a CrossEncoder save rebuilds this family's default modules, so the source's prompts and default_prompt_name no longer describe the load
tests/sentence_transformer/test_model.py:1461
Functiontest_conversion_ignores_source_prompts_and_default_prompt_name
Converting a SentenceTransformer save appends a fresh classification head, so the source's embedding prompts and default_prompt_name are not inher
tests/cross_encoder/test_model.py:1238
Functiontest_conversion_ignores_source_prompts_and_similarity
Converting a MultiVectorEncoder save rebuilds this family's default modules, so the source's prompts, default_prompt_name and similarity_fn_name a
tests/sparse_encoder/test_model.py:992
Functiontest_conversion_ignores_source_similarity_fn_name
A SparseEncoder save carries similarity_fn_name="dot", chosen for sparse embeddings. The converted dense model scores with the dense default inste
tests/sentence_transformer/test_model.py:1488
Functiontest_convert_dense_sentence_transformer_resets_similarity_to_maxsim
A dense SentenceTransformer is converted to a MultiVectorEncoder on load. Its saved ``similarity_fn_name`` ("cosine" / "dot" can't score ragged pe
tests/multi_vector_encoder/test_model.py:821
← previousnext →2,401–2,500 of 4,575, ranked by callers