MCPcopy Create free account

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

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

↓ 3 callersMethodget_anchor_positive_triplet_mask
Return a 2D mask where mask[a, p] is True iff a and p are distinct and have same label. Args: labels: tf.int32 `Tensor` with shape
sentence_transformers/sentence_transformer/losses/batch_hard_triplet.py:241
↓ 3 callersMethodget_batch_sampler
Returns the appropriate batch sampler based on the ``batch_sampler`` argument in ``self.args``. This batch sampler class supports ``_
sentence_transformers/base/trainer.py:731
↓ 3 callersMethodget_config_dict
(self)
sentence_transformers/multi_vector_encoder/losses/multiple_negatives_ranking.py:128
↓ 3 callersMethodget_config_dict
(self)
sentence_transformers/multi_vector_encoder/losses/distill_kl_div.py:127
↓ 3 callersMethodget_config_dict
(self)
sentence_transformers/multi_vector_encoder/evaluation/triplet.py:96
↓ 3 callersMethodget_config_dict
Get the configuration dictionary. Returns: Dictionary containing the configuration parameters
sentence_transformers/sparse_encoder/losses/csr.py:217
↓ 3 callersFunctionget_device_name
Returns the name of the device where this module is running on. This function only supports single device or basic distributed training setu
sentence_transformers/util/environment.py:56
↓ 3 callersFunctionget_locations
The external data locations that a model refers to.
tests/backend/test_utils.py:85
↓ 3 callersMethodget_multi_dataset_batch_sampler
Returns the appropriate multi-dataset batch sampler based on the ``multi_dataset_batch_sampler`` argument in ``self.args``. This batc
sentence_transformers/base/trainer.py:796
↓ 3 callersMethodget_vocab
(self)
tests/sentence_transformer/losses/test_cached_gist_embed.py:35
↓ 3 callersMethodhas_pair_roles
Whether any conversation in a batch carries both of the ``query``/``document`` pair roles. Anchored on produced messages so both routes into
sentence_transformers/base/modality.py:506
↓ 3 callersFunctionhas_static_embedding_input
Whether the model embeds its inputs with a StaticEmbedding, directly or behind a Router. StaticEmbedding features are an EmbeddingBag (``input_id
sentence_transformers/base/losses/gradcache.py:278
↓ 3 callersMethodload_file_path
A utility function to load a file from a model checkpoint. The checkpoint can be either a local directory or a model id on Hugging Face.
sentence_transformers/base/modules/module.py:233
↓ 3 callersFunctionloss_and_grads
(loss_fn: torch.nn.Module)
tests/sentence_transformer/losses/test_cached_gist_embed.py:337
↓ 3 callersFunctionmock_encode
We simply one-hot encode the sentences. If a sentence contains a keyword, the corresponding one-hot encoding is added to the sentence
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:15
↓ 3 callersFunctionmodify_processor_for_pairs
(model: Transformer)
tests/base/modules/transformer/conftest.py:764
↓ 3 callersFunctionparaphrase_mining
Given a list of sentences / texts, this function performs paraphrase mining. It compares all sentences against all other sentences and return
sentence_transformers/util/retrieval.py:24
↓ 3 callersMethodpool_one
(self, embedding)
tests/multi_vector_encoder/evaluation/test_utils.py:47
↓ 3 callersMethodpossible_values
Returns a list of possible values for the SimilarityFunction enum. Returns: list: A list of possible values for the Simi
sentence_transformers/util/similarity.py:964
↓ 3 callersFunctionpredict
(threshold)
tests/sentence_transformer/evaluation/test_binary_classification_evaluator.py:79
↓ 3 callersFunctionresolve_gradient_cache_loss
Follow ``.loss`` wrappers to find the loss implementing ``calculate_loss``.
sentence_transformers/base/losses/gradcache.py:224
↓ 3 callersMethodsave_to_hub
DEPRECATED, use `push_to_hub` instead. Uploads all elements of this model to a new HuggingFace Hub repository. Args:
sentence_transformers/base/model.py:1024
↓ 3 callersFunctionset_temporary_class_attrs
(cls, **overrides)
sentence_transformers/base/modules/transformer.py:531
↓ 3 callersMethodsimilarity
(self, a, b)
tests/sentence_transformer/evaluation/test_information_retrieval_evaluator.py:46
↓ 3 callersFunctionstack_padded_token_embeddings
Stack a list of ``(B, T_i, D)`` token embeddings and their ``(B, T_i)`` masks along ``dim=1``, padding each column up to the batch-wide max token
sentence_transformers/util/tensor.py:280
↓ 3 callersFunctiontokenizer
(_tokenizer: Tokenizer)
tests/conftest.py:281
↓ 3 callersMethodtruncate_embeddings
In this context, :meth:`SentenceTransformer.encode` outputs embeddings truncated at dimension ``truncate_dim``. This may be
sentence_transformers/sentence_transformer/model.py:1200
↓ 3 callersMethodtry_to_set_ir_model_from_evaluators
(self)
sentence_transformers/base/model_card.py:1343
↓ 3 callersFunctionxtr_kd_scores
XTR scoring for knowledge distillation. Same global top-k scoring as :func:`xtr_scores`, but returns each query's own N-way document scores `
sentence_transformers/multi_vector_encoder/scoring/xtr.py:130
↓ 2 callersFunctionF
(e,t)
docs/_static/js/custom.js:28
↓ 2 callersMethod__init__
(self, callback: Callable[[float, int, int], None], evaluator: BaseEvaluator)
sentence_transformers/sentence_transformer/fit_mixin.py:138
↓ 2 callersMethod__init__
The LambdaLoss Framework for Ranking Metric Optimization. This loss function implements the LambdaLoss framework for ranking metric optimizat
sentence_transformers/cross_encoder/losses/lambda_loss.py:105
↓ 2 callersMethod__init__
(self, module: nn.Module)
tests/sentence_transformer/losses/test_adaptive_layer.py:19
↓ 2 callersMethod__init__
(self, loss)
tests/sentence_transformer/losses/test_matryoshka.py:272
↓ 2 callersMethod_append_csv_headers
(self, similarity_fn_names: list[str])
sentence_transformers/sentence_transformer/evaluation/binary_classification.py:123
↓ 2 callersMethod_append_csv_headers
(self, score_function_names)
sentence_transformers/sentence_transformer/evaluation/information_retrieval.py:201
↓ 2 callersMethod_append_csv_headers
(self, similarity_fn_names)
sentence_transformers/sentence_transformer/evaluation/triplet.py:161
↓ 2 callersMethod_append_csv_headers
(self, similarity_fn_names: list[str])
sentence_transformers/sentence_transformer/evaluation/embedding_similarity.py:134
↓ 2 callersMethod_append_csv_headers
(self, score_function_names)
sentence_transformers/sentence_transformer/evaluation/nano_beir.py:289
↓ 2 callersFunction_build_loss
(model: SparseEncoder)
tests/sparse_encoder/losses/test_merged_forward.py:43
↓ 2 callersMethod_call_processor
Call the appropriate processor with the correct arguments. Dispatches based on the processor type and modality: 1. **Message modalit
sentence_transformers/base/modules/transformer.py:1785
↓ 2 callersFunction_canonicalize_side
Shared input front door for one side of a scoring call: masks become a single tensor (a list of per-item masks is padded to the batch), and a bare
sentence_transformers/util/similarity.py:294
↓ 2 callersFunction_compute_scheduled_efficiency
Helper: return fraction of samples that appear in properly balanced batches (not the remainder).
tests/base/samplers/test_group_by_label_batch_sampler.py:162
↓ 2 callersFunction_configure_kernel
Kernelize the supplied kernel-aware layers in place.
sentence_transformers/util/kernels.py:72
↓ 2 callersMethod_create_model_card
Create an automatic model card and store it in the specified path. Args: path (str): The path where the model card will
sentence_transformers/base/model.py:982
↓ 2 callersFunction_create_video_dataset
Create a small Dataset with a Video feature column from synthetic video files.
tests/base/test_model_card.py:1407
↓ 2 callersFunction_dequantize_embeddings
Restore scalar-quantized candidates to the coordinate system of the float query.
sentence_transformers/util/quantization.py:453
↓ 2 callersFunction_embedding_dim
The trailing embedding dimension, read without materializing a padded batch.
sentence_transformers/util/similarity.py:363
↓ 2 callersFunction_embeddings_device
The device multi-vector embeddings live on, or None for numpy and empty inputs.
sentence_transformers/util/similarity.py:323
↓ 2 callersMethod_flattened
(self, lengths: list[int])
tests/sentence_transformer/losses/test_gradcache.py:536
↓ 2 callersMethod_get_default_modality_config
Get the default modality configuration for the current transformer task. Returns: tuple[ModalityConfig, str]: A tuple of (modalit
sentence_transformers/base/modules/transformer.py:2844
↓ 2 callersFunction_get_modality_sample_generators
(model: Transformer)
tests/base/modules/transformer/conftest.py:501
↓ 2 callersMethod_get_model_config
(self)
sentence_transformers/multi_vector_encoder/model.py:1155
↓ 2 callersMethod_get_operations
(self, device: torch.device)
sentence_transformers/multi_vector_encoder/scoring/colbert.py:334
↓ 2 callersMethod_get_processor_attributes
Get the attributes of the processor if available. Will be removed in the future as transformers v5 becomes the minimum requirement. R
sentence_transformers/base/modules/transformer.py:2591
↓ 2 callersMethod_get_task_for_column
Resolve the task a column is preprocessed with. Subclasses may add positional defaults.
sentence_transformers/base/data_collator.py:82
↓ 2 callersMethod_get_untruncated_embedding_dimension
(self)
sentence_transformers/sentence_transformer/model.py:1176
↓ 2 callersMethod_get_untruncated_embedding_dimension
(self)
sentence_transformers/multi_vector_encoder/model.py:1696
↓ 2 callersMethod_infer_and_gather
(self, payload: tuple[list, dict[str, Any]])
sentence_transformers/util/distributed.py:169
↓ 2 callersFunction_ir_eval_data
()
tests/multi_vector_encoder/evaluation/test_information_retrieval.py:11
↓ 2 callersMethod_is_flash_attention_requested
Whether the loaded model was configured for FlashAttention-2 (via ``attn_implementation``).
sentence_transformers/base/modules/transformer.py:1262
↓ 2 callersFunction_is_video_frames
(value: Any)
sentence_transformers/base/modality.py:175
↓ 2 callersMethod_linkage_fn
Resolve fastcluster or scipy once, including when fastcluster is unavailable.
sentence_transformers/multi_vector_encoder/modules/token_pooling.py:220
↓ 2 callersMethod_load_default_modules
Args: model_name_or_path (str): The name or path of the pre-trained model. token (Optional[Union[bool, str]]): The t
sentence_transformers/base/model.py:1259
↓ 2 callersFunction_looks_like_url
Check if a string looks like a valid URL (starts with http(s) and has no spaces).
sentence_transformers/base/modality.py:60
↓ 2 callersMethod_make_image_dataset
(self, n: int = 5)
tests/base/test_model_card.py:585
↓ 2 callersFunction_make_model
(model_type)
tests/base/test_distributed_evaluation.py:35
↓ 2 callersFunction_make_ragged_feature
Like ``_make_feature``, but each sample has its own real token count. ``mini_batch_num_tokens`` packs by real tokens, so it only produces uneven m
tests/multi_vector_encoder/losses/test_misc.py:183
↓ 2 callersFunction_make_similarity_evaluator
()
tests/base/test_model_card.py:1534
↓ 2 callersFunction_maxsim
( a: list | np.ndarray | Tensor, b: list | np.ndarray | Tensor, a_mask: Tensor | None = None,
sentence_transformers/util/similarity.py:441
↓ 2 callersFunction_maxsim_pairwise
( a: list | np.ndarray | Tensor, b: list | np.ndarray | Tensor, a_mask: Tensor | None = None,
sentence_transformers/util/similarity.py:605
↓ 2 callersMethod_maybe_load_stanford_metadata
Read Stanford-NLP ColBERT settings from ``artifact.metadata`` and stash them on ``self._legacy`` for the Transformer constructor + prefix-toke
sentence_transformers/multi_vector_encoder/model.py:1476
↓ 2 callersMethod_message_skeleton
Replace each non-system message content with ``filler``, keeping everything else verbatim. Keeping system messages whole lets the derivation
sentence_transformers/base/modules/transformer.py:2187
↓ 2 callersMethod_model_score_functions
(self, model: SentenceTransformer)
sentence_transformers/sentence_transformer/evaluation/information_retrieval.py:219
↓ 2 callersMethod_multi_process_worker
Run inference on queued chunks in a worker process. Workers are terminated externally via ``stop_multi_process_pool``.
sentence_transformers/base/model.py:2057
↓ 2 callersFunction_on_cpu
(value)
tests/base/test_multi_process.py:63
↓ 2 callersFunction_pad_chunk
Pad one chunk of a side onto the scoring device, with its mask narrowed to the chunk's local width. Padding the whole batch upfront instead would
sentence_transformers/util/similarity.py:343
↓ 2 callersFunction_pairwise_angle_sim_legacy
Pre-#3223 complex-chunk implementation, kept for numerical/gradient parity checks.
tests/util/test_similarity.py:459
↓ 2 callersFunction_patch_hfapi
(method: str, **kwargs)
tests/base/test_trainer.py:43
↓ 2 callersMethod_pool_documents
Pool unpadded documents. Subclasses can override this to process several at once.
sentence_transformers/multi_vector_encoder/modules/token_pooling.py:201
↓ 2 callersMethod_processor_revision
Return the revision that the processor would be loaded with, without loading anything.
tests/base/modules/test_transformer.py:1725
↓ 2 callersMethod_push_from_checkpoint
(self, checkpoint_folder: str)
sentence_transformers/base/trainer.py:1036
↓ 2 callersFunction_query_token_counts
Per-item count of real query tokens for MeanMaxSim scoring: the mask sum when a mask is given, the item lengths for ragged lists, and the non-zero
sentence_transformers/util/similarity.py:380
↓ 2 callersMethod_record_sparsity_stats
(self, model: SparseEncoder, embeddings: torch.Tensor, prefix: str)
sentence_transformers/sparse_encoder/evaluation/sparse_information_retrieval.py:282
↓ 2 callersMethod_register_prefix_tokens
Mark a prompt-prefix token as special so the tokenizer emits it as a single piece. Call only with the prefixes of an existing token-prepended
sentence_transformers/multi_vector_encoder/model.py:1190
↓ 2 callersMethod_render_examples_table
Render the examples table for a dataset, saving non-text values as assets when possible. Returns: A tuple of ``(rendered_table, n
sentence_transformers/base/model_card.py:1779
↓ 2 callersMethod_resolve_activation_fn
Instantiate an activation function from a dotted path string, respecting trust_remote_code.
sentence_transformers/cross_encoder/model.py:360
↓ 2 callersFunction_resolve_retrieval_model_class
Resolve the concrete ``*ForRetrieval`` class (ColPali, ColQwen2, ...) for ``transformer_task="retrieval"``. transformers (as of v5.13) has no ``A
sentence_transformers/base/modules/transformer.py:158
↓ 2 callersMethod_save_asset
Save a non-text value to the assets directory, deduplicating by content hash. Args: value: The non-text value to save, e.g. an im
sentence_transformers/base/model_card.py:823
↓ 2 callersFunction_save_pretrained_wrapper
Wraps the save_pretrained method of a model to save to a subfolder. Args: _save_pretrained_fn: The original save_pretrained function
sentence_transformers/backend/utils.py:21
↓ 2 callersFunction_shrink_reference
(tensor: Tensor, dim: int)
tests/multi_vector_encoder/losses/test_matryoshka.py:64
↓ 2 callersFunction_student_kd_scores
Mirror the evaluator's student MaxSim scoring so teacher scores can be built from it.
tests/multi_vector_encoder/evaluation/test_distillation.py:88
↓ 2 callersFunction_token_lengths
(embeddings: list | np.ndarray | Tensor)
sentence_transformers/util/similarity.py:374
↓ 2 callersMethod_validate_input
(sentence_features: list[dict[str, Tensor]])
sentence_transformers/sentence_transformer/losses/mega_batch_margin.py:135
↓ 2 callersMethod_warn_on_unsupported_attention_config
Warn if the config requests bidirectional attention settings not supported by the installed transformers version.
sentence_transformers/base/modules/transformer.py:2326
↓ 2 callersFunction_wav_bytes
(frequency: int)
tests/base/samplers/test_no_duplicates_batch_sampler.py:27
↓ 2 callersMethodactivation_checkpointing_enable
Enable activation checkpointing for the model. Args: activation_checkpointing_kwargs (dict[str, Any], optional): Keyword argument
sentence_transformers/base/model.py:1667
↓ 2 callersMethodactive_adapters
If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT official documentation: htt
sentence_transformers/base/peft_mixin.py:114
↓ 2 callersFunctionall_gather
Gathers a tensor from each distributed rank into a list. Always retains gradients for the local rank's tensor, and optionally retains gradien
sentence_transformers/util/distributed.py:38
↓ 2 callersFunctionall_gather_padded
All-gather a ``(B, T, D)`` token-embedding tensor and its ``(B, T)`` mask across ranks, padding the token axis to the cross-rank max ``T`` first.
sentence_transformers/util/distributed.py:91
← previousnext →401–500 of 4,575, ranked by callers