MCPcopy Create free account

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

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

Methodtest_list_keeps_document_order_and_individual_dtypes_and_dimensions
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:181
Methodtest_list_method_output_name_hidden_states
A list method_output_name like ["hidden_states", -1] should auto-enable output_hidden_states and traverse the output path to return the correc
tests/base/modules/test_transformer.py:856
Methodtest_list_of_chat_messages
(self)
tests/base/test_modality.py:195
Methodtest_list_of_message_dicts_not_pair
(self)
tests/base/test_modality.py:1329
Methodtest_list_truncated
(self)
tests/base/test_model_card.py:238
Functiontest_listmle_large_scores_match_sequential_cross_entropy
(loss_cls, respect_input_order, offset)
tests/cross_encoder/losses/test_misc.py:228
Functiontest_listwise_loss_is_padding_invariant
(reranker_bert_tiny_model_v54: CrossEncoder, loss_cls, respect_input_order)
tests/cross_encoder/losses/test_misc.py:74
Functiontest_listwise_loss_supports_low_precision
( reranker_bert_tiny_model_v54: CrossEncoder, loss_cls, dtype: torch.dtype )
tests/cross_encoder/losses/test_misc.py:38
Functiontest_load_activation_fn_from_config
(tanh_model_name: str, tmp_path)
tests/cross_encoder/test_model.py:833
Functiontest_load_activation_fn_from_config_custom
(reranker_bert_tiny_model: CrossEncoder, tmp_path: Path)
tests/cross_encoder/test_model.py:845
Functiontest_load_activation_fn_from_kwargs
( num_labels: int, activation_fn: torch.nn.Module | None, expected_activation_fn: torch.nn.Module,
tests/cross_encoder/test_model.py:792
Functiontest_load_adapter_with_revision
()
tests/sentence_transformer/test_model.py:990
Functiontest_load_and_encode
(model_name: str)
tests/sparse_encoder/test_pretrained.py:148
Methodtest_load_audio_from_video_routing
(self, monkeypatch, video_flag, chat_flag, use_processor_kwargs)
tests/base/modules/test_transformer.py:1260
Functiontest_load_checkpoint_with_peft_and_lora
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:562
Methodtest_load_config_default_modality_config_for_old_models
Models saved without modality_config should get the default text-only config.
tests/base/modules/test_transformer.py:2009
Methodtest_load_config_deserializes_tuple_keys
load_config should deserialize plus-separated keys back to tuples.
tests/base/modules/test_transformer.py:1982
Methodtest_load_config_strips_trust_remote_code
load_config should remove trust_remote_code from sub-dicts.
tests/base/modules/test_transformer.py:1995
Functiontest_load_dir_path_hf_validation_error_returns_none
`HFValidationError` (malformed repo id) is unambiguously "not on the Hub". Short-circuit to ``None`` rather than retrying.
tests/util/test_file_io.py:319
Functiontest_load_dir_path_incomplete_snapshot_raises
`IncompleteSnapshotError` subclasses `LocalEntryNotFoundError` but is transient, so it must propagate rather than turn into a `None` module path.
tests/util/test_file_io.py:385
Functiontest_load_dir_path_local_entry_not_found_returns_none
`LocalEntryNotFoundError` from the first `snapshot_download` (e.g. offline + nothing cached) should short-circuit to ``None`` without retrying the
tests/util/test_file_io.py:306
Functiontest_load_dir_path_local_missing_short_circuits
Regression test for #3370. The local-dir guard short-circuits to ``None`` and `snapshot_download` is never called, so callers don't see a confusin
tests/util/test_file_io.py:240
Functiontest_load_dir_path_local_subfolder_exists
`load_dir_path` returns the resolved local path when the subfolder exists.
tests/util/test_file_io.py:254
Functiontest_load_dir_path_nonlocal_path_calls_hub
When the path is not an existing local directory, the local-dir guard must not fire and `snapshot_download` should still be invoked.
tests/util/test_file_io.py:264
Functiontest_load_dir_path_raises_when_the_snapshot_lacks_the_subfolder
`snapshot_download` can hand back a cached snapshot without the requested subfolder when its Hub call fails and no tree listing is cached. That mu
tests/util/test_file_io.py:371
Functiontest_load_dir_path_transient_with_cache_hit
When the first `snapshot_download` fails with a transient error but the cache has the model, `load_dir_path` should return the cached path.
tests/util/test_file_io.py:331
Functiontest_load_dir_path_transient_with_cache_miss_reraises_original
When the first call fails with a transient error and the cache also lacks the model, the original transient error is re-raised (not the cache miss
tests/util/test_file_io.py:345
Functiontest_load_dir_path_transient_with_partial_cache_reraises_original
A cached snapshot that never received the subfolder is a cache miss as well.
tests/util/test_file_io.py:360
Functiontest_load_file_path_allows_hub_cache_symlinks
(tmp_path: Path, filename: str)
tests/util/test_file_io.py:208
Functiontest_load_file_path_entry_not_found_returns_none
`EntryNotFoundError` (file genuinely missing from the repo) should be swallowed and return ``None`` so callers can fall back to defaults (e.g. wra
tests/util/test_file_io.py:278
Functiontest_load_file_path_local_exists
`load_file_path` returns the local path when the file is present.
tests/util/test_file_io.py:121
Functiontest_load_file_path_local_missing_short_circuits
When the parent is a real local directory but the requested file is missing, `load_file_path` should return ``None`` without calling `hf_hub_downl
tests/util/test_file_io.py:103
Functiontest_load_file_path_nonlocal_path_calls_hub
When the path is not an existing local directory, the local-dir guard must not fire and `hf_hub_download` should still be invoked.
tests/util/test_file_io.py:227
Functiontest_load_file_path_transient_error_propagates
Transient/auth errors (rate limit, 401, network) must propagate. Returning ``None`` silently would let `_load_modules` fall back to a vanilla tran
tests/util/test_file_io.py:292
Functiontest_load_from_checkpoint_preserves_compiled_model
( stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path, compiled: bool, load_best_model: bool )
tests/base/test_trainer.py:202
Functiontest_load_from_checkpoint_reloads_custom_module_classes
Since v6.0, a module class outside Sentence Transformers requires ``trust_remote_code=True``, which a programmatically built model never carries.
tests/base/test_trainer.py:150
Functiontest_load_gpu_offload_map_for_each_model_family
( request: pytest.FixtureRequest, tmp_path: Path, model_fixture: str, encode_method: str, inputs: list, of
tests/base/test_model.py:1517
Functiontest_load_local_from_pathlib_path
(stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path)
tests/sentence_transformer/test_model.py:330
Functiontest_load_local_with_normalize_at_model_root
(stsb_bert_tiny_model: SentenceTransformer, tmp_path: Path)
tests/sentence_transformer/test_model.py:341
Functiontest_load_local_without_normalize_directory
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:314
Functiontest_load_logs_converting_model_type
Loading a SentenceTransformer model as a SparseEncoder should log the converting message at warning level, so it is visible at the default verbosi
tests/base/test_model.py:591
Functiontest_load_logs_no_modules_json
Loading a plain HF model (no modules.json) should log the initializing message.
tests/base/test_model.py:579
Functiontest_load_model2vec_mapping_and_weights
(tmp_path: Path)
tests/sentence_transformer/modules/test_static_embedding.py:126
Functiontest_load_model2vec_small_weights
(tmp_path: Path, embedding_dtype: torch.dtype, weight_dtype: torch.dtype)
tests/sentence_transformer/modules/test_static_embedding.py:153
Functiontest_load_module_class_from_ref_code_revision
With trust_remote_code=True and code_revision in model_kwargs, it should pop code_revision.
tests/base/test_model.py:702
Functiontest_load_module_class_from_ref_sentence_transformers
A sentence_transformers.* class ref should be imported directly.
tests/base/test_model.py:636
Functiontest_load_module_class_from_ref_trust_remote_code_fallback
With trust_remote_code=True, should try dynamic import first, then fall back on error.
tests/base/test_model.py:679
Functiontest_load_module_class_from_ref_untrusted_ref_raises
A non-sentence_transformers class ref without `trust_remote_code=True` is refused: the import would run repository-chosen code.
tests/base/test_model.py:650
Functiontest_load_paths_allow_relative_paths
(tmp_path: Path, subfolder: str | Path)
tests/util/test_file_io.py:196
Functiontest_load_paths_reject_existing_external_files
(tmp_path: Path, filename: str, absolute: bool)
tests/util/test_file_io.py:176
Functiontest_load_paths_reject_unsafe_paths_before_hub_lookup
( path: str | int | list | dict | None, argument: str, monkeypatch: pytest.MonkeyPatch )
tests/util/test_file_io.py:154
Functiontest_load_projection_dim_mismatch_raises
Loading into a loss whose projection has a different shape should raise.
tests/sentence_transformer/losses/test_embed_distill.py:231
Functiontest_load_projection_matches_model_device
Lazy-constructed projection should land on the model's device so that `load_projection` works when called after the loss has been moved.
tests/sentence_transformer/losses/test_embed_distill.py:217
Functiontest_load_projection_without_projection_dim
`load_projection` should construct the layer from the saved shape when none was configured.
tests/sentence_transformer/losses/test_embed_distill.py:196
Functiontest_load_with_model_kwargs
(monkeypatch: pytest.MonkeyPatch)
tests/sentence_transformer/test_model.py:537
Functiontest_load_with_pytorch_bin
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:67
Functiontest_load_with_revision
()
tests/sentence_transformer/test_model.py:299
Functiontest_load_with_revision
()
tests/cross_encoder/test_model.py:93
Functiontest_load_with_safetensors
()
tests/sentence_transformer/test_model.py:52
Functiontest_load_with_torch_dtype
(stsb_bert_tiny_model: SentenceTransformer)
tests/sentence_transformer/test_model.py:519
Functiontest_loaded_backbone_kernels_are_refreshed_after_device_placement
( loader, monkeypatch, model_class, selection, device_map )
tests/test_kernels.py:782
Functiontest_loaded_model_kernel_settings_are_runtime_only
(loader, tmp_path, embeddings)
tests/test_kernels.py:817
Functiontest_loading_model2vec
()
tests/sentence_transformer/modules/test_static_embedding.py:221
Functiontest_loading_paths_and_separate_base
(model, tmp_path)
tests/test_merging.py:60
Functiontest_loads_native_retriever_archetype
transformers-native late-interaction retrievers (``architectures`` ending in ``ForRetrieval``, i.e. ColPali / ColQwen2 / ColModernVBert) take a di
tests/multi_vector_encoder/test_model.py:622
Functiontest_loads_stanford_colbert_archetype
The Stanford load path has no non-slow coverage, and ``audit_v2.md`` recorded a misload of exactly this archetype as a blocker. Pins that the root
tests/multi_vector_encoder/test_model.py:664
Functiontest_loads_with_default_modules
()
tests/multi_vector_encoder/test_model.py:25
Methodtest_local_file_exists
(self, tmp_path)
tests/base/test_modality.py:45
Methodtest_local_file_exists
(self, tmp_path)
tests/base/test_modality.py:117
Methodtest_local_file_not_exists
(self)
tests/base/test_modality.py:50
Functiontest_logger_warning
(caplog)
tests/cross_encoder/test_model.py:740
Methodtest_long_documents_are_clustered_to_the_budget
(self)
tests/multi_vector_encoder/modules/test_token_pooling.py:386
Methodtest_long_documents_reduce_distance_batch_size
(self, monkeypatch)
tests/multi_vector_encoder/modules/test_token_pooling.py:165
Methodtest_long_string_ids_fall_back_to_dict
(self)
tests/util/test_dataset.py:474
Methodtest_long_string_truncated
(self)
tests/base/test_model_card.py:232
Functiontest_loss_gradients_and_cached_replay
(loader, embeddings, loss_class, reference_scorer)
tests/test_kernels.py:306
Functiontest_loss_gradients_match_manual_training
( loss_training_model, tmp_path, gradient_accumulation_steps: int, loss_class )
tests/base/test_trainer.py:441
Functiontest_loss_ward_inheritance_and_pooler_overrides
(loader, cached, selection)
tests/test_kernels.py:566
Functiontest_losses_follow_model_scoring_and_allow_overrides
(loader, embeddings, loss_class, reference_scorer, normalize)
tests/test_kernels.py:259
Functiontest_losses_match_in_train_mode_with_dropout_zeroed
One merged forward draws a different dropout mask sequence than per-column forwards, so the equivalence is exact only up to dropout sampling. With
tests/sentence_transformer/losses/test_merged_forward.py:198
Functiontest_losses_merged_forward_matches_per_column
Anchor-based losses keep column 0 on its own forward, so only columns 1+ merge.
tests/sentence_transformer/losses/test_merged_forward.py:87
Functiontest_losses_preserve_encoder_masks
(varlen_features, loss_cls)
tests/multi_vector_encoder/losses/test_misc.py:74
Functiontest_losses_read_scoring_mask_from_model_output
The scoring mask comes from the model OUTPUT dict (where the mask module rewrote it), not from the input dict: garbage at positions the output mas
tests/multi_vector_encoder/losses/test_misc.py:391
Functiontest_losses_use_collator_stamped_task_over_positional
Losses read the ``task`` the collator stamped into each column's features (positional query/document only as fallback), so ``router_mapping`` over
tests/multi_vector_encoder/losses/test_misc.py:352
Functiontest_low_precision_scores_match_float32_reference
Scores from upcast low-precision embeddings stay close to the float32 reference.
tests/util/test_similarity.py:588
Methodtest_malformed_string_raises
(self, documents: Dataset)
tests/util/test_dataset.py:153
Methodtest_malformed_url_crash
Malformed URLs (e.g. containing unclosed brackets) should not crash.
tests/base/test_modality.py:62
Methodtest_malformed_url_crash
Malformed URLs (e.g. containing unclosed brackets) should not crash.
tests/base/test_modality.py:98
Methodtest_malformed_url_crash
Malformed URLs (e.g. containing unclosed brackets) should not crash.
tests/base/test_modality.py:125
Methodtest_malformed_url_does_not_crash
Malformed URLs like bare brackets should return text instead of crashing.
tests/base/test_modality.py:157
Functiontest_manhattan_sim
()
tests/util/test_similarity.py:117
Functiontest_manhattan_sim_sparse
Test Manhattan similarity with sparse tensors.
tests/util/test_similarity.py:201
Methodtest_maps_to_processor_arg_names
(self)
tests/base/test_modality.py:395
Functiontest_margin_mse_accepts_1d_labels_for_single_negative
With one negative the margin may arrive as one scalar per row. That 1D form must match the equivalent (batch, 1) column vector.
tests/multi_vector_encoder/losses/test_misc.py:785
Functiontest_margin_mse_accepts_raw_teacher_scores
Raw teacher scores of shape (batch, num_negatives + 1) must yield the same loss as the equivalent pre-computed margins, matching the dense MarginM
tests/multi_vector_encoder/losses/test_misc.py:768
Functiontest_margin_mse_accepts_xtr_pairwise_metric
The unified similarity_fct convention makes xtr_scores_pairwise a drop-in MarginMSE scorer, previously a TypeError from the a_mask/b_mask call.
tests/multi_vector_encoder/losses/test_misc.py:830
Functiontest_margin_mse_merged_forward_matches_per_column
MarginMSE splits the merged forward straight back into per-column tensors: merged, chunked, and per-column fallback paths must all produce the sam
tests/multi_vector_encoder/losses/test_misc.py:695
Functiontest_margin_mse_rejects_mismatched_label_shape
Labels must match (batch, num_negatives) exactly. A wrong column count is neither margins nor raw scores, and a wrong batch would otherwise broadc
tests/multi_vector_encoder/losses/test_misc.py:804
Functiontest_margin_parameters
Test absolute_margin and relative_margin parameters.
tests/util/test_hard_negatives.py:361
Functiontest_margin_with_default_range_max
Test the deprecated margin parameter with the auto-derived range_max, which exceeds the corpus size and relies on the candidate set being capped a
tests/util/test_hard_negatives.py:1279
← previousnext →3,101–3,200 of 4,575, ranked by callers