MCPcopy Create free account

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

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

Functiontest_default_to_csr
()
tests/sparse_encoder/test_model.py:415
Functiontest_default_weights_when_none
Test that default weights (all 1s) are used when weights is None.
tests/sentence_transformer/losses/test_matryoshka.py:180
Functiontest_dense_activation_factory_requires_trust
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, trust_remote_code: bool )
tests/base/modules/test_dense.py:182
Functiontest_dense_config_omits_default_use_residual
``use_residual`` at its default (False) must not be written to config.json: released 5.4-5.6 ``Dense.load`` does ``cls(**config)`` without unknown
tests/base/modules/test_dense.py:160
Functiontest_dense_custom_features_key
Test that Dense can operate on custom feature keys.
tests/base/modules/test_dense.py:63
Functiontest_dense_load_and_save_in_other_precisions
(static_embedding: StaticEmbedding, tmp_path: Path)
tests/base/modules/test_dense.py:20
Functiontest_dense_load_ignores_unknown_config_keys
A newer or foreign save (e.g. a future PyLate ``Dense``) may record a config key this class's constructor does not accept. ``Dense.load`` should d
tests/base/modules/test_dense.py:126
Functiontest_dense_rejects_non_module_activation_class
(tmp_path: Path)
tests/base/modules/test_dense.py:205
Functiontest_dense_save_load_custom_keys
Test that Dense with custom keys can be saved and loaded.
tests/base/modules/test_dense.py:94
Functiontest_dense_save_warns_for_plain_function_activation
( tmp_path: Path, activation_function: Callable, caplog: pytest.LogCaptureFixture )
tests/base/modules/test_dense.py:222
Functiontest_deprecated_import_paths
Test that deprecated import paths point to the correct new paths.
tests/util/test_deprecated_import.py:13
Functiontest_deprecated_parameters
Test deprecated parameters: as_triplets and margin.
tests/util/test_hard_negatives.py:1257
Functiontest_detect_mlm
()
tests/sparse_encoder/test_model.py:407
Methodtest_detection
(self, template, supported)
tests/base/test_modality.py:1615
Functiontest_device_argument_warns_when_device_map_present
Passing both ``device`` and a ``device_map`` should warn that ``device_map`` wins. See #3822.
tests/base/test_model.py:1001
Functiontest_device_assignment
(inference_device: str)
tests/cross_encoder/test_model.py:429
Functiontest_device_map_alignment_reaches_modules_outside_the_backbone
A ``Router`` holds the backbone several levels down, so alignment cannot skip modules by index. ``self[0]`` is the entire model for a Router-firs
tests/base/test_model.py:1034
Functiontest_device_map_aligns_auxiliary_modules_to_backbone
With a ``device_map`` placing the backbone on a GPU, separately-loaded modules (e.g. Dense, which load on CPU) must be moved onto the backbone's d
tests/base/test_model.py:1726
Functiontest_device_map_controls_placement
A ``device_map`` in ``model_kwargs`` must control placement and not be overridden by the auto-detected ``device``. Previously the unconditional ``
tests/base/test_model.py:989
Functiontest_device_map_ignored_for_prebuilt_modules
``device_map`` only applies when loading from a name (via ``from_pretrained``). With pre-built ``modules`` it is inert, so it must not suppress th
tests/base/test_model.py:1747
Functiontest_device_move_does_not_turn_parameters_into_inference_tensors
()
tests/base/test_model.py:1386
Functiontest_device_property
device property should return a torch.device.
tests/base/test_model.py:974
Functiontest_device_reports_where_a_dispatched_model_runs
An offloaded parameter sits on ``meta`` until accelerate streams it in, so it cannot name the device.
tests/base/test_model.py:1210
Functiontest_device_switching
(inference_device: str)
tests/cross_encoder/test_model.py:434
Functiontest_device_uses_buffers_without_parameters
()
tests/base/test_model.py:1378
Methodtest_dict_array_with_mixed_key_types_still_raises_valueerror
(self)
tests/base/test_modality.py:251
Methodtest_dict_array_without_sampling_rate_raises
(self)
tests/base/test_modality.py:207
Methodtest_dict_array_without_video_metadata_raises
(self)
tests/base/test_modality.py:211
Methodtest_dict_audio_dataset_format
(self)
tests/base/test_modality.py:199
Methodtest_dict_chat_message
(self)
tests/base/test_modality.py:191
Methodtest_dict_missing_task_entry_uncapped
(self)
tests/base/test_data_collator.py:214
Methodtest_dict_prompt_returns_matching_column
(self)
tests/base/test_data_collator.py:130
Methodtest_dict_prompt_returns_none_for_missing_column
(self)
tests/base/test_data_collator.py:136
Methodtest_dict_resolves_by_task
(self)
tests/base/test_data_collator.py:201
Methodtest_dict_video_with_metadata
(self)
tests/base/test_modality.py:203
Methodtest_dict_with_video_decoder_value
Nested dict: VideoDecoder values are converted, others kept.
tests/base/test_model_card.py:1228
Methodtest_dict_without_task_leaves_uncapped
(self)
tests/base/test_data_collator.py:209
Methodtest_different_key_orders_keep_native_processor_arguments
(self)
tests/base/test_modality.py:791
Methodtest_different_source_different_hash
(self)
tests/base/test_model_card.py:1138
Functiontest_dim_exceeding_model_dim_raises
()
tests/multi_vector_encoder/losses/test_matryoshka.py:171
Functiontest_dimension_exceeds_model_dimension_raises_error
Test that dimension exceeding model's embedding dimension raises ValueError.
tests/sentence_transformer/losses/test_matryoshka.py:81
Functiontest_dimensions_sorted_descending
Test that dimensions and weights are sorted in descending order.
tests/sentence_transformer/losses/test_matryoshka.py:166
Functiontest_dims_and_weights_sorted_descending
()
tests/multi_vector_encoder/losses/test_matryoshka.py:184
Functiontest_direct_import
Test that functions can be imported directly from sentence_transformers.util
tests/util/test_import.py:24
Methodtest_dispatch_on_image_item
(self)
tests/multi_vector_encoder/test_model_card.py:108
Functiontest_dispatched_second_backbone_is_not_cast_or_moved
( stsb_bert_tiny_model: SentenceTransformer, dispatched_model: SentenceTransformer )
tests/base/test_model.py:1324
Methodtest_display_precedence
usage_examples_display takes precedence over usage_examples for rendering.
tests/sentence_transformer/test_model_card.py:250
Methodtest_display_precedence
usage_examples_display takes precedence over usage_examples for rendering.
tests/base/test_model_card.py:500
Functiontest_distance_metric_matches_reference
Per-metric, the loss should match a hand-computed reference on the same embeddings.
tests/sentence_transformer/losses/test_embed_distill.py:40
Functiontest_distilbert_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:74
Functiontest_distill_kl_div_does_not_warn_on_excluded_candidates
An infinite score marks a candidate the caller excluded on purpose, so its zero probability is not a temperature problem and must not be reported
tests/sentence_transformer/losses/test_distill_kl_div.py:64
Functiontest_distill_kl_div_merged_forward_matches_per_column
The merged (batch_size * n_ways) document forward must score identically to the per-column fallback: for equal-width float columns (merge without
tests/multi_vector_encoder/losses/test_misc.py:641
Functiontest_distill_kl_div_mini_batch_matches_full
mini_batch_size splits the merged forward into row chunks, each embedded at its own width (leading padding kept, so the left-padded column keeps i
tests/multi_vector_encoder/losses/test_misc.py:675
Functiontest_distill_kl_div_rejects_a_single_candidate
A softmax over one candidate is constant, so the loss and gradient are identically zero: that must fail loudly rather than report a perfect loss w
tests/sentence_transformer/losses/test_distill_kl_div.py:75
Functiontest_distill_kl_div_rejects_mismatched_label_width
A narrower label tensor broadcasts across the candidates instead of erroring, which trains the student toward a uniform distribution at a plausibl
tests/sentence_transformer/losses/test_distill_kl_div.py:44
Functiontest_distill_kl_div_rejects_nan_teacher_scores
NaN labels make every gradient NaN on the first backward, and the exact-zero collapse check cannot see them since ``nan == 0`` is False.
tests/sentence_transformer/losses/test_distill_kl_div.py:54
Functiontest_distill_kl_div_rejects_unusable_temperatures
A negative temperature silently inverts the objective and NaN poisons every weight on the first backward, so both are rejected at construction.
tests/sentence_transformer/losses/test_distill_kl_div.py:36
Functiontest_distill_kl_div_rejects_unusable_temperatures
A non-positive temperature silently inverts the objective and NaN poisons every weight on the first backward, so both are rejected at construction
tests/multi_vector_encoder/losses/test_misc.py:509
Functiontest_distill_kl_div_separate_temperatures
student_temperature / teacher_temperature default to the shared temperature and split the two softmaxes when set, with the loss scaled by the stud
tests/sentence_transformer/losses/test_distill_kl_div.py:85
Functiontest_distill_kl_div_separate_temperatures
student_temperature / teacher_temperature default to the shared temperature and split the two softmaxes when set, with the loss scaled by the stud
tests/multi_vector_encoder/losses/test_misc.py:865
Functiontest_distill_kl_div_validates_input_columns_and_label_shape
Too few input columns, or teacher scores whose width does not match the number of document columns, must fail loud instead of producing an opaque
tests/multi_vector_encoder/losses/test_misc.py:489
Functiontest_distill_kl_div_warns_once_when_the_teacher_collapses
A teacher_temperature well below the teacher's score spread underflows the target to exact zeros, so those candidates carry no gradient. Checked o
tests/sentence_transformer/losses/test_distill_kl_div.py:9
Functiontest_distill_kl_div_warns_once_when_the_teacher_collapses
This loss works in log space, so it hands the check ``teacher_log_probs.exp()``, which is the target ``KLDivLoss(log_target=True)`` consumes rathe
tests/multi_vector_encoder/losses/test_misc.py:517
Functiontest_distillation_evaluator
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/evaluation/test_distillation.py:12
Functiontest_distillation_evaluator_config_dict
()
tests/multi_vector_encoder/evaluation/test_distillation.py:241
Functiontest_distillation_evaluator_flat_kl_is_full_sum
The flat-path KL is the full divergence between the two dataset-level distributions, not divided by the number of pairs, so duplicating every pair
tests/multi_vector_encoder/evaluation/test_distillation.py:211
Functiontest_distillation_evaluator_per_query_candidate_sets
The KD training format: N candidate documents per query with 2-D teacher scores. The KL is computed per query over its own candidate set, mirrorin
tests/multi_vector_encoder/evaluation/test_distillation.py:27
Functiontest_distillation_evaluator_rejects_mismatched_nested_shapes
()
tests/multi_vector_encoder/evaluation/test_distillation.py:271
Functiontest_distillation_evaluator_rejects_non_positive_temperature
()
tests/multi_vector_encoder/evaluation/test_distillation.py:264
Functiontest_distillation_evaluator_spearman_is_per_query
A student reproducing the teacher's within-query ranking exactly must score Spearman 1.0, regardless of the per-query score bands.
tests/multi_vector_encoder/evaluation/test_distillation.py:99
Functiontest_distillation_evaluator_spearman_skips_constant_queries
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/evaluation/test_distillation.py:128
Functiontest_distillation_evaluator_temperature_matches_training_loss
The nested-path KL equals what MultiVectorDistillKLDivLoss reports for the same queries, documents and teacher scores, for shared, per-side, and M
tests/multi_vector_encoder/evaluation/test_distillation.py:152
Functiontest_distillation_evaluator_tensor_scores
( mve_bert_tiny_model: MultiVectorEncoder, nested: bool, dtype: torch.dtype, grad_mode: str, device: str )
tests/multi_vector_encoder/evaluation/test_distillation.py:62
Functiontest_distillation_evaluator_token_pooling_and_truncate_dim
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/evaluation/test_distillation.py:295
Functiontest_distributed_evaluation_without_process_group
(enabled)
tests/base/test_distributed_evaluation.py:206
Functiontest_distributed_evaluator_inference
(model_type, use_cuda, tmp_path)
tests/base/test_distributed_evaluation.py:226
Methodtest_do_lower_case
do_lower_case should add exactly one Lowercase normalizer and actually lowercase tokens.
tests/base/modules/test_transformer.py:125
Methodtest_do_lower_case_false_does_not_modify_normalizer
do_lower_case=False should not modify the tokenizer normalizer.
tests/base/modules/test_transformer.py:209
Methodtest_do_lower_case_noop_when_lowercase_already_present
If the normalizer already has Lowercase, do_lower_case should not add another.
tests/base/modules/test_transformer.py:142
Methodtest_do_lower_case_prepends_to_existing_sequence
When normalizer is a Sequence without Lowercase, Lowercase should be prepended.
tests/base/modules/test_transformer.py:158
Methodtest_do_lower_case_tokenizer_persisted_after_save_load
The Lowercase normalizer added to the tokenizer should persist after save/load.
tests/base/modules/test_transformer.py:220
Methodtest_do_lower_case_with_none_normalizer
When normalizer is None, do_lower_case should create a Sequence with just Lowercase.
tests/base/modules/test_transformer.py:192
Methodtest_do_lower_case_wraps_single_normalizer
When normalizer is a single non-Sequence normalizer, it should be wrapped with Lowercase.
tests/base/modules/test_transformer.py:175
Methodtest_document_length_applies_to_document_task_only
Tasks are ``"query"`` / ``"document"`` throughout the library: ``document_length`` only truncates ``task="document"`` batches, any other task
tests/base/modules/test_transformer.py:883
Functiontest_documents_format
Test with 'documents' format produces both base and reranked metrics.
tests/cross_encoder/evaluation/test_reranking.py:40
Functiontest_dot_score_cos_sim
()
tests/util/test_similarity.py:126
Functiontest_dot_score_sparse
Test dot product with sparse tensors.
tests/util/test_similarity.py:187
Functiontest_drop_last_false_yields_remainder
(two_label_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:58
Functiontest_drop_last_true_no_short_batches
(balanced_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:48
Functiontest_dtype_no_parameters
dtype should return None for a model with no parameters.
tests/base/test_model.py:1796
Functiontest_dtype_promotion_per_tensor
(model)
tests/test_merging.py:183
Functiontest_dtype_property
dtype should return a torch.dtype for a model with parameters.
tests/base/test_model.py:1790
Methodtest_duplicate_images_deduplicated
Identical images are saved only once and share the same path.
tests/base/test_model_card.py:329
Methodtest_duplicate_images_deduplicated
Duplicate images in the first rows are skipped. Unique images are picked from later rows.
tests/base/test_model_card.py:698
Methodtest_duplicate_lookup_ids_warn_and_resolve_to_last
(self, caplog)
tests/util/test_dataset.py:323
Methodtest_each_member_receives_the_full_cluster_gradient
( self, normalize_embeddings: bool, dtype: torch.dtype )
tests/multi_vector_encoder/modules/test_token_pooling.py:525
Functiontest_efficiency_few_imbalanced_labels
6 imbalanced labels.
tests/base/samplers/test_group_by_label_batch_sampler.py:176
Functiontest_efficiency_many_imbalanced_labels
Many imbalanced labels.
tests/base/samplers/test_group_by_label_batch_sampler.py:183
Functiontest_embed_columns_shares_one_forward_pass
( stsb_bert_tiny_model: SentenceTransformer, monkeypatch: pytest.MonkeyPatch )
tests/sentence_transformer/losses/test_merged_forward.py:62
Functiontest_embedding_distillation_with_tensor_formatted_labels
(loss_training_model, tmp_path)
tests/base/test_trainer.py:408
← previousnext →2,601–2,700 of 4,575, ranked by callers