MCPcopy Create free account

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

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

Functiontest_get_installed_version_python
()
tests/util/test_environment.py:111
Functiontest_get_max_seq_length
get_max_seq_length should return an int for transformer-based models.
tests/base/test_model.py:1760
Functiontest_get_model_kwargs
Test that get_model_kwargs returns the correct keyword arguments.
tests/sentence_transformer/test_model.py:1295
Functiontest_get_model_kwargs
Test that get_model_kwargs returns the correct keyword arguments.
tests/sparse_encoder/test_model.py:594
Functiontest_get_model_type_missing_key_defaults_to_sentence_transformer
A config without 'model_type' key should default to 'SentenceTransformer' (backward compat).
tests/base/test_model.py:1952
Functiontest_get_model_type_no_config_defaults_to_sentence_transformer
When config_sentence_transformers.json is missing, _get_model_type defaults to 'SentenceTransformer'.
tests/base/test_model.py:1943
Functiontest_get_model_type_reads_model_type
_get_model_type should return the model_type from config when present.
tests/base/test_model.py:1963
Functiontest_get_n_patches_idefics3_raises_not_implemented
Idefics3 / SmolVLM split-image token order (sub-patch blocks plus a trailing global patch) is not a plain row-major grid, so ``get_n_patches`` ref
tests/multi_vector_encoder/test_interpretability.py:274
Functiontest_get_n_patches_non_square_seq_length_raises
()
tests/multi_vector_encoder/test_interpretability.py:268
Functiontest_get_n_patches_output_plugs_into_similarity_map
The returned ``(n_cols, n_rows)`` tuple feeds ``maxsim_similarity_map``'s ``n_patches`` directly: an embedding with ``n_cols * n_rows`` tokens res
tests/multi_vector_encoder/test_interpretability.py:241
Functiontest_get_n_patches_paligemma_fixed_grid
PaliGemma / Gemma3 style processors use a fixed square grid of ``image_seq_length`` image tokens, independent of the input image size.
tests/multi_vector_encoder/test_interpretability.py:256
Functiontest_get_n_patches_qwen_dynamic_grid
Qwen-VL grids follow smart_resize. (28, 28) upscales to the min pixel budget, (4000, 3000) downscales to the max budget, and (13, 2000) hits the n
tests/multi_vector_encoder/test_interpretability.py:204
Functiontest_get_n_patches_qwen_matches_colpali_engine
Cross-check the processor-reported grid against colpali-engine's reference ColQwen2Processor.get_n_patches, invoked unbound on a processor stub so
tests/multi_vector_encoder/test_interpretability.py:225
Functiontest_get_n_patches_qwen_respects_pixel_budget
A reduced max_pixels budget (e.g. colqwen2 checkpoints ship 768 * 28 * 28) caps the grid, so a mid-size and a huge image clamp to the same grid ar
tests/multi_vector_encoder/test_interpretability.py:214
Functiontest_get_n_patches_text_only_model_raises
Text-only models (tokenizer-only processor) have no image-patch grid.
tests/multi_vector_encoder/test_interpretability.py:286
Functiontest_get_n_patches_unknown_family_raises
A processor matching no known family (no merge_size, no Idefics3 markers, no image_seq_length) raises a ValueError naming the attributes it looked
tests/multi_vector_encoder/test_interpretability.py:293
Functiontest_gist_embed_guide_embeds_the_original_features
The guide must embed the columns as collated, not as the training model left them. With ``include_prompt`` disabled the model swaps a prompt-exclu
tests/sentence_transformer/losses/test_merged_forward.py:165
Functiontest_gist_embed_repeated_calls_with_the_same_dicts_match
Wrapper losses like MatryoshkaLoss call the inner loss repeatedly with the same feature dicts. Pooling's prompt-excluded mask replacement is not i
tests/sentence_transformer/losses/test_merged_forward.py:184
Functiontest_gist_matryoshka_matches_cached_gist_matryoshka
``MatryoshkaLoss(GISTEmbedLoss(...))`` must match ``MatryoshkaLoss(CachedGISTEmbedLoss(...))``. The plain loss used to run the guide on the same
tests/sentence_transformer/losses/test_cached_gist_embed.py:404
Functiontest_gist_retokenizes_each_sentence
(loss_class, flattened: bool)
tests/sentence_transformer/losses/test_cached_gist_embed.py:66
Functiontest_gradcache_backward_releases_the_hook_state
The backward hook partial holds each forward's cache and tokenized features. Dropping the loss tensor after backward must release them, or a train
tests/sentence_transformer/losses/test_gradcache.py:406
Functiontest_gradcache_ddp
(tmp_path, world_size, static_graph, accumulate)
tests/base/test_gradcache_distributed.py:190
Functiontest_gradcache_names_the_unused_column
A ``calculate_loss`` that ignores an input column leaves its embeddings without gradients. The mixin must raise a pointed error at forward time, n
tests/sentence_transformer/losses/test_gradcache.py:233
Functiontest_gradcache_preserves_fp64_gradients
(stsb_bert_tiny_model: SentenceTransformer, mini_batch_size: int)
tests/sentence_transformer/losses/test_gradcache.py:73
Functiontest_gradcache_replays_dropout_in_the_backward_pass
The backward pass must re-embed exactly what the forward pass embedded, dropout included. The cached gradients belong to the first pass's embeddin
tests/sentence_transformer/losses/test_gradcache.py:90
Functiontest_gradcache_replays_through_prompt_exclusion
``Pooling(include_prompt=False)`` zeroes prompt positions in the attention mask. It used to do so in place on the caller's features, through the m
tests/sentence_transformer/losses/test_gradcache.py:348
Functiontest_gradcache_scales_with_the_outer_backward
Scaling the returned loss (gradient accumulation, fp16 loss scaling) must scale the whole gradient: the backward hook is what carries ``grad_outpu
tests/sentence_transformer/losses/test_gradcache.py:150
Functiontest_gradcache_token_budget_replays_dropout
The backward hook must replay the exact (uneven) token-budget boundaries of the forward pass. With dropout active, any boundary drift would surfac
tests/sentence_transformer/losses/test_gradcache.py:317
Functiontest_gradcache_token_budget_trims_but_matches_mnrl
Trimming padded mini-batches to their own width must not change the loss or gradient: the dropped columns are padding for every sequence in the mi
tests/sentence_transformer/losses/test_gradcache.py:513
Functiontest_gradcache_token_budget_two_forwards_before_one_backward
The per-forward boundaries must ride each forward pass's backward hook: two batches with different length distributions produce different ranges,
tests/sentence_transformer/losses/test_gradcache.py:434
Functiontest_gradcache_two_forwards_before_one_backward
Each forward pass must hand its own cached gradients to its own backward hook, so summing two forward passes of one loss object must equal using t
tests/sentence_transformer/losses/test_gradcache.py:122
Functiontest_gradcache_under_autocast
Under autocast, the cached gradients are reduced-precision while the backward hook's re-embedding runs outside autocast in fp32, so the surrogate
tests/sentence_transformer/losses/test_gradcache.py:197
Functiontest_gradcache_under_no_grad
The loss must be computable under ``torch.no_grad``, as the trainer does for the eval loss.
tests/sentence_transformer/losses/test_gradcache.py:178
Functiontest_gradient_checkpointing_skips_unsupporting_wrapper
()
tests/multi_vector_encoder/test_model.py:234
Functiontest_group_by_label_batch_sampler_label_a
(dummy_dataset: Dataset, precompute_hashes: bool)
tests/base/samplers/test_no_duplicates_batch_sampler.py:114
Functiontest_hash_asset_distinguishes_real_same_shape_videos
Two real in-memory clips of identical shape and duration must not collapse to one asset.
tests/base/test_model_card.py:1380
Functiontest_heatmap_aggregate_amax_returns_single_image
``aggregate="amax"`` is the legacy behaviour (max over query tokens).
tests/multi_vector_encoder/test_interpretability.py:131
Functiontest_heatmap_aggregate_invalid_raises
()
tests/multi_vector_encoder/test_interpretability.py:159
Functiontest_heatmap_aggregate_none_returns_list
()
tests/multi_vector_encoder/test_interpretability.py:144
Functiontest_heatmap_aggregated_returns_single_image
()
tests/multi_vector_encoder/test_interpretability.py:119
Functiontest_hf_argument_parser
()
tests/sentence_transformer/test_training_args.py:14
Functiontest_hf_argument_parser_incorrect_string_arguments
(argument_name)
tests/sentence_transformer/test_training_args.py:68
Functiontest_hf_argument_parser_no_duplicates_hashed
()
tests/sentence_transformer/test_training_args.py:53
Functiontest_hf_tokenizer_preprocess_returns_token_id_lists
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/modules/test_word_embeddings.py:132
Methodtest_hidden_dim
Models with hidden_dim should return it.
tests/base/modules/test_transformer.py:1149
Methodtest_hidden_sizes_list
Models with hidden_sizes (list) should return the last element.
tests/base/modules/test_transformer.py:1141
Functiontest_hierarchical_batched_normalization_without_pooling
(monkeypatch, device, dtype, empty_batch)
tests/multi_vector_encoder/modules/test_token_pooling.py:748
Functiontest_hierarchical_normalization_config_compatibility
(tmp_path, normalize_embeddings: bool | None)
tests/multi_vector_encoder/modules/test_token_pooling.py:700
Functiontest_hierarchical_normalization_without_merging
( dtype: torch.dtype, pool_factor: float, num_tokens: int, num_protected_tokens: int )
tests/multi_vector_encoder/modules/test_token_pooling.py:717
Functiontest_hierarchical_normalization_zero_centroid
(dtype: torch.dtype)
tests/multi_vector_encoder/modules/test_token_pooling.py:739
Functiontest_hierarchical_output_normalization_includes_protected_tokens
(tmp_path)
tests/multi_vector_encoder/modules/test_token_pooling.py:685
Functiontest_hierarchical_pooling_helper_reduces_token_count
()
tests/multi_vector_encoder/test_model.py:1370
Methodtest_hierarchical_pooling_round_trips_through_pickle
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:303
Methodtest_homogeneous_audio_ndarray
(self)
tests/base/test_modality.py:356
Methodtest_homogeneous_images_ndarray
(self)
tests/base/test_modality.py:352
Methodtest_homogeneous_multimodal_dicts
(self)
tests/base/test_modality.py:370
Methodtest_homogeneous_text
(self)
tests/base/test_modality.py:349
Functiontest_hps_collapses_spurious_ties
Upcasting the scoring step recovers the tie structure of float32. A naive low-precision matmul buckets scores coarsely and produces spurious
tests/util/test_similarity.py:549
Methodtest_http_url
(self)
tests/base/test_modality.py:33
Methodtest_https_jpg
(self)
tests/base/test_modality.py:24
Methodtest_https_mp3
(self)
tests/base/test_modality.py:105
Methodtest_https_mp4
(self)
tests/base/test_modality.py:69
Methodtest_https_with_fragment
(self)
tests/base/test_modality.py:30
Methodtest_https_with_query_params
(self)
tests/base/test_modality.py:27
Methodtest_https_with_query_params
(self)
tests/base/test_modality.py:72
Methodtest_https_with_query_params
(self)
tests/base/test_modality.py:108
Functiontest_hub_revision_is_resolved_before_model_loading
(monkeypatch: pytest.MonkeyPatch)
tests/base/test_model.py:444
Methodtest_image_column_stats
Image columns show width x height stats.
tests/base/test_model_card.py:727
Methodtest_image_example_placeholder_without_save_dir
Without save_dir, image examples show placeholder text.
tests/base/test_model_card.py:743
Methodtest_image_example_saved_with_save_dir
With save_dir, image examples are saved as files and rendered with <img> tags.
tests/base/test_model_card.py:758
Methodtest_image_https_url
(self)
tests/base/test_modality.py:148
Methodtest_image_image_pair
(self)
tests/base/test_modality.py:1303
Methodtest_image_image_pairs
Image-image pairs should be converted to message format.
tests/base/test_modality.py:1456
Methodtest_image_only_model
Image-only model: usage_examples is a list of images, not dicts.
tests/base/test_model_card.py:633
Methodtest_image_path_column_skips_preprocess
(self, stsb_bert_tiny_model: SentenceTransformer)
tests/base/test_model_card.py:820
Methodtest_image_text_pair
(self)
tests/base/test_modality.py:1295
Methodtest_image_url_classified_as_text_when_unsupported
parse_inputs should respect supported_modalities from InputFormatter.
tests/base/test_modality.py:964
Methodtest_image_url_detected_when_supported
(self)
tests/base/test_modality.py:308
Methodtest_image_url_falls_back_to_text_when_unsupported
(self)
tests/base/test_modality.py:299
Methodtest_image_url_inputs
(self)
tests/base/test_modality.py:581
Functiontest_imbalanced_dataset_multi_class
(imbalanced_dataset: Dataset)
tests/base/samplers/test_group_by_label_batch_sampler.py:125
Functiontest_import
(module_names: list[str], module_attributes: list[object])
tests/cross_encoder/evaluation/test_deprecated.py:76
Functiontest_import_module_class_forwards_token_to_dynamic_module
Custom remote modules in private repos require the auth token to be forwarded to `get_class_from_dynamic_module`. Without it, the modeling file fe
tests/util/test_misc.py:58
Functiontest_import_module_class_local_path_with_trust_loads
Passing `trust_remote_code=True` is the explicit opt-in that v6.0 requires, so the dynamic load runs and its class is returned.
tests/util/test_misc.py:178
Functiontest_import_module_class_local_path_without_trust_raises
A local model directory is no longer implicitly trusted (#3801): a non-ST custom class requires `trust_remote_code=True` regardless of where the m
tests/util/test_misc.py:109
Functiontest_import_module_class_sentence_transformers_namespace_skips_dynamic_loading
Built-in `sentence_transformers.*` classes should never trigger the dynamic-module code path, even when token/trust_remote_code are passed.
tests/util/test_misc.py:90
Functiontest_import_module_class_trusted_fallback_imports_directly
A trusted ref whose dynamic load fails falls through to the direct import, for local directories and Hub repos alike.
tests/util/test_misc.py:146
Functiontest_import_module_class_untrusted_hub_ref_raises
A non-ST class ref without `trust_remote_code=True` is refused outright: no dynamic loading, and no direct-import fallback that would resolve an a
tests/util/test_misc.py:127
Functiontest_import_module_class_without_model_name_needs_no_trust
The trust gate only applies when a model is involved: a bare programmatic import (`model_name_or_path=None`) is the caller's own code choosing a c
tests/util/test_misc.py:167
Functiontest_import_reload
Test that util module can be reloaded without errors
tests/util/test_import.py:58
Functiontest_imported_from_full_path_first
Test that classes from deprecated paths are the same object as from new paths. Some import mechanisms had significant issues with e.g.: >>> f
tests/util/test_deprecated_import.py:74
Functiontest_imported_from_partial_path_first
Test that classes from deprecated paths are the same object as from new paths.
tests/util/test_deprecated_import.py:52
Methodtest_impossible_budget_and_invalid_samples
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:500
Functiontest_include_positives
Test include_positives parameter.
tests/util/test_hard_negatives.py:435
Functiontest_include_positives_warning
( dataset: Dataset, static_retrieval_mrl_en_v1_model: SentenceTransformer, caplog: pytest.LogCaptu
tests/util/test_hard_negatives.py:461
Functiontest_include_positives_with_labeled_formats
Test include_positives with labeled pair and list formats.
tests/util/test_hard_negatives.py:481
Functiontest_incompatible_models
(model, problem)
tests/test_merging.py:241
Functiontest_incompatible_torch_module_settings
(model, activation, other_activation)
tests/test_merging.py:324
Functiontest_incorrect_backend
()
tests/sentence_transformer/test_backends.py:136
Functiontest_incorrect_backend
(model_dir)
tests/multi_vector_encoder/test_backends.py:115
← previousnext →2,901–3,000 of 4,575, ranked by callers