MCPcopy Create free account

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

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

Functiontest_semantic_search_rescores_integer_query_embeddings
Disqualifying the padding with -inf must not overflow on integer query embeddings.
tests/util/test_quantization.py:616
Functiontest_semantic_search_scalar_rescoring_float16_calibration
(search_fn, precision, bound, calibration_source)
tests/util/test_quantization.py:362
Functiontest_semantic_search_scalar_rescoring_restores_calibration
Rescoring must use the original coordinate system, including constant dimensions. These corpus values are exactly representable with the supplied
tests/util/test_quantization.py:301
Functiontest_semantic_search_usearch_binary_matches_ubinary
``binary`` packs the same bytes as ``ubinary`` with the top bit of each flipped. Undoing that offset makes the two precisions the same b1 index,
tests/util/test_quantization.py:633
Functiontest_semantic_search_usearch_drops_padded_indices
A corpus smaller than ``top_k`` must not produce duplicated entries. usearch zero-fills a short result set with key 0 and a NaN distance instead
tests/util/test_quantization.py:509
Functiontest_semantic_search_usearch_empty_corpus
An empty corpus yields empty result lists rather than phantom hits.
tests/util/test_quantization.py:552
Functiontest_semantic_search_usearch_float_index_preserves_native_scores
(dtype: str, metric: str)
tests/util/test_quantization.py:693
Functiontest_semantic_search_usearch_preserves_large_keys
A caller's index may key documents anywhere in the unsigned 64-bit range.
tests/util/test_quantization.py:587
Functiontest_semantic_search_usearch_rescores_non_byte_aligned_embeddings
Padding bits from ``np.packbits`` must not reach the rescoring.
tests/util/test_quantization.py:487
Functiontest_semantic_search_usearch_returns_top_k_when_corpus_is_large_enough
The padding check must not shorten results for a corpus larger than ``top_k``.
tests/util/test_quantization.py:568
Functiontest_semantic_search_usearch_signed_binary_rescoring_preserves_ranking
The -128 offset on ``binary`` corpus bytes must be undone, or the ranking can flip.
tests/util/test_quantization.py:461
Functiontest_semantic_search_usearch_single_query_short_corpus
A single query returns ``Matches``, which has no ``counts`` and needs no padding removal.
tests/util/test_quantization.py:535
Functiontest_semi_hard_triplet_matches_reference
(dummy_model, case, distance_metric)
tests/sentence_transformer/losses/test_triplet.py:73
Functiontest_semi_hard_triplet_saved_tensors_are_quadratic
Mining must not retain a cubic distance tile or mask for backward.
tests/sentence_transformer/losses/test_triplet.py:94
Functiontest_semi_hard_triplet_tied_maximum_negative_gradients
A negative tied with the row maximum must receive its own gradient.
tests/sentence_transformer/losses/test_triplet.py:113
Functiontest_sentence_t5_slow
(stsb_dataset_dict: DatasetDict)
tests/sentence_transformer/test_pretrained_stsb.py:111
Functiontest_sentence_transformer
(stsb_bert_tiny_model: SentenceTransformer)
tests/base/test_model.py:329
Functiontest_separate_corpus
Test using a separate corpus for negative mining.
tests/util/test_hard_negatives.py:191
Methodtest_separate_modalities_no_combined_dict
A CLIP-like model (text + image separately, no tuple) does NOT build combined dicts. Instead, it picks the first non-text modality and shows
tests/base/test_model_card.py:611
Methodtest_separate_processor_repository_is_not_pinned_to_model_revision
(self, monkeypatch)
tests/base/modules/test_transformer.py:1745
Methodtest_sequence_classification_default_num_labels
When loading a non-SeqCls model with task='sequence-classification', num_labels defaults to 1.
tests/base/modules/test_transformer.py:120
Functiontest_sequential_evaluator_can_be_reused
(container)
tests/base/evaluation/test_sequential.py:24
Functiontest_sequential_evaluator_retains_model_card_metrics
()
tests/base/evaluation/test_sequential.py:32
Functiontest_sequential_nano_beir_retains_distinct_pooling_results
(monkeypatch, mve_bert_tiny_model, tmp_path)
tests/multi_vector_encoder/evaluation/test_nano_beir.py:85
Functiontest_set_base_model_uses_resolved_revision_without_hub_lookup
(monkeypatch: pytest.MonkeyPatch)
tests/base/test_model.py:43
Methodtest_set_transform_and_batched_map_agree
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:78
Methodtest_set_transform_ignores_prior_format
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:405
Methodtest_sets_and_restores
(self)
tests/base/modules/test_transformer.py:88
Methodtest_shape_comment_placeholder_without_measured_shapes
(self)
tests/multi_vector_encoder/test_model_card.py:99
Methodtest_shape_comment_uses_measured_shapes_when_available
(self)
tests/multi_vector_encoder/test_model_card.py:90
Methodtest_shape_comment_uses_query_and_document_counts
(self)
tests/multi_vector_encoder/test_model_card.py:147
Functiontest_sharded_evaluator_participates_on_all_ranks
Exercise backend routing with a collective evaluator on two CPU ranks.
tests/base/test_trainer.py:380
Functiontest_shared_colbert_adapters_keep_masks_grouping_and_normalization
( loader, embeddings, adapter, mean_adapter, layout_adapter, pairwise )
tests/test_kernels.py:347
Methodtest_shared_index_survives_format_normalization
(self, documents: Dataset)
tests/util/test_dataset.py:387
Functiontest_shared_training_adapter_can_compile_and_round_trip
(loader, embeddings)
tests/test_kernels.py:377
Methodtest_short_documents_pass_through_unchanged
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:392
Methodtest_short_list_not_truncated
(self)
tests/base/test_model_card.py:242
Methodtest_short_string
(self)
tests/base/test_model_card.py:229
Functiontest_shrink_zero_padding_has_finite_values_and_gradients
(dtype: torch.dtype)
tests/sentence_transformer/losses/test_matryoshka.py:33
Methodtest_sibling_sampling_rate_key_hints_array_form
(self)
tests/base/test_modality.py:266
Methodtest_sibling_video_metadata_key_hints_array_form
(self)
tests/base/test_modality.py:256
Functiontest_similarity_accepts_encoded_tensor_list
(word_embeddings_model, score_function)
tests/util/test_similarity.py:1316
Functiontest_similarity_fct_config_includes_hyperparameters
Configured metric objects serialize with their hyperparameters, so ``XTRScores(top_k=16)`` and ``XTRScores(top_k=256)`` are distinguishable in mod
tests/multi_vector_encoder/losses/test_misc.py:439
Functiontest_similarity_fct_config_renders_partial_bindings
A functools.partial similarity_fct (e.g. MeanMaxSim via length_normalize) serializes with its bound settings, like configured metric objects do.
tests/multi_vector_encoder/losses/test_misc.py:852
Functiontest_similarity_fn_name_constructor_overrides_saved
( stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path )
tests/sentence_transformer/test_model.py:793
Functiontest_similarity_fn_name_constructor_overrides_saved
(splade_bert_tiny_model: SparseEncoder, tmp_path: Path)
tests/sparse_encoder/test_model.py:729
Functiontest_similarity_fn_name_rejects_multi_vector_names
MaxSim scores ragged token embeddings: setting it on a dense model would produce wrong shapes silently, so it must fail loud with a pointer to Mul
tests/sentence_transformer/test_model.py:1439
Functiontest_similarity_fn_name_rejects_multi_vector_names
MaxSim scores ragged token embeddings: setting it on a sparse model would produce wrong shapes silently, so it must fail loud with a pointer to Mu
tests/sparse_encoder/test_model.py:972
Functiontest_similarity_fn_name_set_via_enum
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:785
Functiontest_similarity_fn_name_set_via_enum
(splade_bert_tiny_model: SparseEncoder)
tests/sparse_encoder/test_model.py:721
Functiontest_similarity_fn_name_setter_rejects_unsupported
Single-vector similarities can't score ragged token embeddings: assignment must fail loud instead of deferring the failure to scoring time.
tests/multi_vector_encoder/test_model.py:1167
Functiontest_similarity_forwards_scoring_kwargs
Extra similarity kwargs reach the scoring function: a tiny element budget reproduces the plain scores, an unknown kwarg fails loudly, and a device
tests/multi_vector_encoder/test_model.py:1673
Functiontest_similarity_function_enum_has_maxsim
()
tests/multi_vector_encoder/test_model.py:1718
Functiontest_similarity_map_normalize_per_token
``normalize=True`` rescales each query token's map to ``[0, 1]`` independently.
tests/multi_vector_encoder/test_interpretability.py:59
Functiontest_similarity_map_rectangular_grid_row_major
Regression: with a rectangular grid, the resulting map must preserve the (row, col) positions from the flat row-major embedding, not transpose the
tests/multi_vector_encoder/test_interpretability.py:72
Functiontest_similarity_map_shape_and_values
Output is ``(Qt, n_rows, n_cols)`` and the value at ``(q, r, c)`` equals ``q_emb[q] · img_emb[row=r, col=c]`` (assuming row-major ViT patch order)
tests/multi_vector_encoder/test_interpretability.py:19
Functiontest_similarity_map_shape_mismatch_raises
()
tests/multi_vector_encoder/test_interpretability.py:50
Functiontest_similarity_map_with_image_mask
``image_mask`` filters non-image tokens out of ``image_embedding`` before reshaping.
tests/multi_vector_encoder/test_interpretability.py:36
Functiontest_similarity_mixed_sparse_dense
Test that mixing a sparse and a dense operand matches the all-dense result.
tests/util/test_similarity.py:382
Functiontest_similarity_returns_maxsim
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:791
Functiontest_similarity_score
(stsb_bert_tiny_model: SentenceTransformer, similarity_fn_name: str)
tests/sentence_transformer/test_model.py:740
Functiontest_similarity_score
(splade_bert_tiny_model: SparseEncoder, similarity_fn_name: str)
tests/sparse_encoder/test_model.py:687
Functiontest_similarity_score_save
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:768
Functiontest_similarity_score_save
(splade_bert_tiny_model: SparseEncoder, tmp_path: Path)
tests/sparse_encoder/test_model.py:711
Functiontest_similarity_singular_query
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:1700
Functiontest_simple
(test_data, stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path)
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:81
Functiontest_simple_encode
(clip_vit_b_32_model: SentenceTransformer)
tests/sentence_transformer/test_image_embeddings.py:14
Methodtest_single_and_list_with_same_base_coexist
(self, documents: Dataset)
tests/util/test_dataset.py:335
Methodtest_single_columns_unaffected
(self, queries: Dataset, documents: Dataset)
tests/util/test_dataset.py:121
Functiontest_single_device_map_ignores_encode_device_until_explicit_move
(device_map: str | dict, move_method: str)
tests/base/test_model.py:1552
Methodtest_single_element_not_pair
(self)
tests/base/test_modality.py:1316
Methodtest_single_example_uses_symmetric_lists
(self)
tests/multi_vector_encoder/test_model_card.py:119
Methodtest_single_frame_fallback
All batch decodes fail, falls back to single-frame access.
tests/base/test_model_card.py:1188
Functiontest_single_input_contributes_nothing
(loss: GlobalOrthogonalRegularizationLoss)
tests/sentence_transformer/losses/test_global_orthogonal_regularization.py:50
Functiontest_single_input_does_not_poison_a_combined_loss
GOR is meant to be added to a task loss, so one nan term takes the whole sum with it.
tests/sentence_transformer/losses/test_global_orthogonal_regularization.py:75
Functiontest_single_input_loss_stays_differentiable
The returned zero has to keep the graph, or backward on a lone GOR loss raises.
tests/sentence_transformer/losses/test_global_orthogonal_regularization.py:60
Methodtest_single_item_batch
(self)
tests/base/test_modality.py:377
Methodtest_single_key_dict_in_pair_unwraps
A ``{"image": pil}`` wrapper inside a pair should unwrap to the bare PIL value.
tests/base/test_modality.py:1421
Methodtest_single_key_image_dict_unwraps
A ``{"image": pil}`` wrapper should behave like a bare PIL image input.
tests/base/test_modality.py:811
Methodtest_single_key_multimodal_dict_collapses_to_bare_modality
(self)
tests/base/test_modality.py:226
Methodtest_single_key_text_dict_unwraps
A ``{"text": "hello"}`` wrapper should behave like a bare text input.
tests/base/test_modality.py:821
Functiontest_single_label_does_not_broadcast_over_batch
(loss_class, num_columns, labels)
tests/sentence_transformer/losses/test_misc.py:82
Methodtest_single_modality_tokenizer
Single-modality tokenizer path should work for text.
tests/base/modules/test_transformer.py:1213
Methodtest_single_positional_arg_unchanged
(self)
tests/util/test_decorators.py:463
Functiontest_single_sample
Single sample still works.
tests/cross_encoder/evaluation/test_reranking.py:75
Methodtest_single_texts
(self)
tests/base/test_modality.py:1227
Functiontest_singular_input_unwraps
(mve_bert_tiny_model: MultiVectorEncoder)
tests/multi_vector_encoder/test_model.py:757
Functiontest_skiplist_words_set_at_init_and_resolved_on_demand
The skiplist is set at construction. Changing it on a built model requires the documented resolve_with_tokenizer call, which then takes effect.
tests/multi_vector_encoder/test_model.py:1903
Functiontest_slerp_merges_every_module
(model)
tests/test_merging.py:75
Methodtest_slices_by_image_count
(self, features, begin, end, image_begin, image_end)
tests/sentence_transformer/losses/test_cmnrl.py:362
Methodtest_slices_tokens_and_rebuilds_metadata
(self)
tests/sentence_transformer/losses/test_gradcache.py:547
Methodtest_small_dataset_fewer_examples
Dataset smaller than 3 examples: uses what's available.
tests/base/test_model_card.py:674
Functiontest_sparse_cosent_loss_default_matches_explicit_pairwise
( splade_bert_tiny_model: SparseEncoder, )
tests/sparse_encoder/losses/test_sparse_cosent.py:10
Functiontest_sparse_cosent_matches_pair_matrix_with_tied_labels
(loss_class, sparse)
tests/sparse_encoder/losses/test_sparse_cosent.py:33
Functiontest_sparse_distill_kl_div_forwards_per_side_temperatures
The sparse subclass takes the per-side temperatures and hands them to the dense implementation, including its default of 2.0 rather than the dense
tests/sparse_encoder/losses/test_sparse_distill_kl_div.py:15
Functiontest_sparse_distill_kl_div_must_be_wrapped
It only makes sense inside SpladeLoss / CSRLoss, which supply the sparsity regularizers, so calling it directly fails loudly instead of training a
tests/sparse_encoder/losses/test_sparse_distill_kl_div.py:31
Functiontest_sparse_encoder
(splade_bert_tiny_model: SparseEncoder)
tests/base/test_model.py:338
Methodtest_sparse_encoder_class_name
(self)
tests/sparse_encoder/test_model_card.py:275
Methodtest_sparse_encoder_custom_model_id
(self)
tests/sparse_encoder/test_model_card.py:286
Functiontest_sparse_static_embedding_from_json_partial_vocabulary
( splade_bert_tiny_model: SparseEncoder, tmp_path: Path )
tests/sparse_encoder/modules/test_sparse_static_embedding.py:71
← previousnext →4,101–4,200 of 4,575, ranked by callers