MCPcopy Create free account

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

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

↓ 1 callersFunction_parse_string_encoded_lists
(column: list, col_name: str)
sentence_transformers/util/dataset.py:56
↓ 1 callersMethod_pool_batch
Pool a right-padded ``(B, T, D)`` batch and return embeddings with their new lengths.
sentence_transformers/multi_vector_encoder/modules/token_pooling.py:471
↓ 1 callersMethod_pool_documents
Batch unpadded documents, pool them, and trim output padding.
sentence_transformers/multi_vector_encoder/modules/token_pooling.py:432
↓ 1 callersFunction_pooling_name
Describe a pooling variant for configs and model cards.
sentence_transformers/multi_vector_encoder/losses/token_pooling.py:15
↓ 1 callersMethod_post_init
Final construction step, called at the end of ``__init__``: fires every module's :meth:`~sentence_transformers.base.modules.Module.on_model_re
sentence_transformers/base/model.py:386
↓ 1 callersFunction_power_method
(transition_matrix, increase_power=True, max_iter=10000)
examples/sentence_transformer/applications/text-summarization/lex_rank.py:39
↓ 1 callersMethod_push_to_hub_usage_tip
Return a usage tip snippet for the push_to_hub PR description. Subclasses can override this to provide model-type-specific example code.
sentence_transformers/base/model.py:2241
↓ 1 callersFunction_reconcile_video_metadata
Resolve the per-sample video metadata entries collected by :func:`_unwrap_video`. If no video in the batch carried metadata, the key is dropped s
sentence_transformers/base/modality.py:219
↓ 1 callersFunction_reconstruct_loss_components
Rebuild a per-component loss dict around a single gradient-carrying total. The trainer sums a dict-valued loss for its backward pass, but after g
sentence_transformers/sparse_encoder/losses/cached_splade.py:20
↓ 1 callersFunction_record_sampling_rate
Record the batch-level ``sampling_rate``, raising if samples disagree. Feature extractors accept a single ``sampling_rate`` for the whole batch,
sentence_transformers/base/modality.py:133
↓ 1 callersFunction_reference_loss
(embeddings, labels, distance_metric, margin)
tests/sentence_transformer/losses/test_batch_all_triplet.py:11
↓ 1 callersMethod_render_message_skeleton
Tokenize one conversation's skeleton (non-system content replaced by ``filler``), untruncated. The render shares ``_apply_chat_template`` wit
sentence_transformers/base/modules/transformer.py:2202
↓ 1 callersMethod_report_worker_failure
Log a chunk that a worker failed to process and build the result to enqueue for it. :meth:`_multi_process` blocks for exactly one result per
sentence_transformers/base/model.py:2097
↓ 1 callersMethod_resolve_scalar
Resolve a string-or-per-dataset mapping to a single string for this batch.
sentence_transformers/cross_encoder/data_collator.py:84
↓ 1 callersFunction_run_ddp_evaluation_loop_in_group
( rank: int, world_size: int, tmp_dir: str, sharded_backend: str | None = None )
tests/base/test_trainer.py:304
↓ 1 callersFunction_run_gradcache_ddp
(rank, world_size, init_method, static_graph=False, accumulate=True)
tests/base/test_gradcache_distributed.py:86
↓ 1 callersMethod_save_checkpoint
(self, checkpoint_path, checkpoint_save_total_limit, step)
sentence_transformers/sentence_transformer/fit_mixin.py:721
↓ 1 callersMethod_score
( self, query_embeddings: Tensor, document_embeddings: Tensor, query_mask: Tensor, document_mask: Tens
sentence_transformers/multi_vector_encoder/losses/margin_mse.py:107
↓ 1 callersFunction_semi_hard_reference
Select each negative directly, without the production mining implementation.
tests/sentence_transformer/losses/test_triplet.py:46
↓ 1 callersFunction_separate_forwards
Note why the columns are embedded separately, then return None so the caller falls back. Speed only: the per-column path produces the same loss a
sentence_transformers/base/losses/merged_forward.py:21
↓ 1 callersMethod_should_flatten_inputs
Whether to pack variable-length text inputs into a single flat sequence (FA2 unpadding). Only safe for text-only inputs, since :class:`DataCo
sentence_transformers/base/modules/transformer.py:1242
↓ 1 callersFunction_split_kernel_config
(config: KernelConfig, targets: set[str])
sentence_transformers/util/kernels.py:27
↓ 1 callersFunction_take
(ids: list, value_view, index: _SortedIdIndex | dict, value_col: str, input_col: str)
sentence_transformers/util/dataset.py:118
↓ 1 callersFunction_tie_encoder_decoder_weights
Tie the encoder's parameters to the decoder's: each encoder parameter is replaced by the identically-named decoder parameter, so the two share sto
sentence_transformers/sentence_transformer/losses/denoising_auto_encoder.py:16
↓ 1 callersFunction_to_device
Move one side's padded embeddings and mask onto the scoring device. The mask is checked separately, since a caller can hand in a cpu mask alongsid
sentence_transformers/util/similarity.py:332
↓ 1 callersFunction_unbind_padded
Split a padded ``(B, T, D)`` tensor into a list of ``(t_i, D)`` per-sample tensors. Pass ``attention_mask`` for the general case. Without a mask,
sentence_transformers/multi_vector_encoder/modules/token_pooling.py:27
↓ 1 callersFunction_unique_state_dict
Return one entry per tensor object and a map from every original key to its representative. Deduplicating tied weights prevents stochastic method
sentence_transformers/base/merging.py:117
↓ 1 callersFunction_unwrap_audio
Unwrap dict-wrapped audio or an ``AudioDecoder`` into a raw array, collecting ``sampling_rate``. Passes through unchanged if ``audio_value`` is a
sentence_transformers/base/modality.py:149
↓ 1 callersFunction_unwrap_video
Unwrap dict-wrapped video or a ``VideoDecoder`` into a raw array, collecting ``video_metadata``. Passes through unchanged if ``video_value`` is a
sentence_transformers/base/modality.py:184
↓ 1 callersMethod_update_default_model_id
Update the default model ID in the model card.
sentence_transformers/base/model.py:973
↓ 1 callersMethod_validate_dataset_names
(self)
sentence_transformers/sentence_transformer/evaluation/nano_beir.py:501
↓ 1 callersMethod_validate_dataset_names
(self)
sentence_transformers/cross_encoder/evaluation/nano_beir.py:409
↓ 1 callersFunction_validate_models
Check input compatibility before merging, using the first model as reference. Require torch, no quantized modules or PEFT adapters, matching modu
sentence_transformers/base/merging.py:34
↓ 1 callersMethod_validate_prompts
(self)
sentence_transformers/sentence_transformer/evaluation/nano_beir.py:515
↓ 1 callersMethod_validate_prompts
Validate prompt configuration and log prompt information.
sentence_transformers/base/model.py:395
↓ 1 callersMethod_validate_query_expansion_token
Tokenizer-aware checks. The structural ``_normalize_query_expansion`` runs without the tokenizer, so this method catches the two silent-wrong-
sentence_transformers/base/modules/transformer.py:1064
↓ 1 callersMethod_verify_left_padding
Verify that causal inputs are left-padded, i.e. that every sample ends in a real token. Checks the produced ``attention_mask`` rather than ``
sentence_transformers/base/modules/transformer.py:1567
↓ 1 callersMethod_verify_pair_roles_supported
Raise if the chat template cannot carry the ``query``/``document`` roles a pair is mapped to. A template that only branches on ``system``/``u
sentence_transformers/base/modules/transformer.py:1526
↓ 1 callersMethod_workers_are_spawned
Whether dataloader workers start via ``spawn`` rather than ``fork``/``forkserver``. Only ``spawn`` pays the import cost per worker. A ``forks
sentence_transformers/base/training_args.py:266
↓ 1 callersFunction_wrap_numpy
View a numpy array as a tensor without copying its buffer, which on a corpus of embeddings costs as much as the scoring it feeds. Two kinds of arr
sentence_transformers/util/tensor.py:11
↓ 1 callersFunction_xxhash_int64
(value: str)
sentence_transformers/base/sampler.py:383
↓ 1 callersFunctionaddGithubButton
()
docs/_static/js/custom.js:1
↓ 1 callersMethodadd_dataset
( self, parallel_sentences: list[list[str]], weight: int = 100, max_sentences:
sentence_transformers/sentence_transformer/datasets/parallel_sentences.py:116
↓ 1 callersMethodadd_dataset_name_column
( self, dataset: DatasetDict | IterableDatasetDict | Dataset | IterableDataset, datase
sentence_transformers/base/trainer.py:1148
↓ 1 callersMethodadd_many
(self, values)
sentence_transformers/base/model_card.py:80
↓ 1 callersMethodadd_model_card_callback
Add a callback responsible for automatically tracking data required for the automatic model card generation This method is called in
sentence_transformers/base/trainer.py:396
↓ 1 callersFunctionadd_notice_log_level
Creates a new 'notice' logging level
sentence_transformers/util/logging.py:27
↓ 1 callersMethodadd_transitive_closure
(graph)
sentence_transformers/sentence_transformer/evaluation/paraphrase_mining.py:253
↓ 1 callersMethodapproximate_ranks
Compute differentiable approximate ranks using the ApproxRank formulation. For each document i: ``approx_rank(i) = 1 + sum_{j != i} sigmoid(a
sentence_transformers/cross_encoder/losses/adr_mse.py:117
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_make_multilingual_example.py:64
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_cross_encoder_example.py:56
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sparse_encoder_distillation_example.py:59
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_with_lora_example.py:112
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_example.py:69
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_matryoshka_example.py:50
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_cross_encoder_distillation_example.py:65
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_multi_vector_encoder_example.py:69
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sparse_encoder_example.py:56
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_cross_encoder_listwise_example.py:73
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_multi_dataset_example.py:98
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer.
skills/train-sentence-transformers/scripts/train_sentence_transformer_static_embedding_example.py:79
↓ 1 callersFunctionautocast_ctx
bf16/fp16 autocast for evaluator calls outside the trainer (which has its own autocast).
skills/train-sentence-transformers/scripts/train_sentence_transformer_distillation_example.py:94
↓ 1 callersMethodbatch_all_triplet_loss
Build the triplet loss over a batch of embeddings. We generate all the valid triplets and average the loss over the positive ones. Arg
sentence_transformers/sentence_transformer/losses/batch_all_triplet.py:100
↓ 1 callersMethodbatch_hard_triplet_loss
Build the triplet loss over a batch of embeddings. For each anchor, we get the hardest positive and hardest negative to form a triplet.
sentence_transformers/sentence_transformer/losses/batch_hard_triplet.py:167
↓ 1 callersMethodbatch_hard_triplet_soft_margin_loss
Build the triplet loss over a batch of embeddings. For each anchor, we get the hardest positive and hardest negative to form a triplet.
sentence_transformers/sentence_transformer/losses/batch_hard_soft_margin_triplet.py:102
↓ 1 callersMethodbatch_search
(self, **kwargs)
tests/sparse_encoder/test_search_engines.py:18
↓ 1 callersMethodbatch_semi_hard_triplet_loss
Build the triplet loss over a batch of embeddings. We generate all the valid triplets and average the loss over the positive ones. Arg
sentence_transformers/sentence_transformer/losses/batch_semi_hard_triplet.py:113
↓ 1 callersFunctionbuild
(corrupt: bool, n_docs: int, batch_size: int = batch)
tests/multi_vector_encoder/losses/test_misc.py:396
↓ 1 callersFunctionbuild_evaluator
Per-language MSE + TranslationEvaluator. `main_score_function` averages translation accuracies only. MSE (`negative_mse * 100`) is on a different
skills/train-sentence-transformers/scripts/train_sentence_transformer_make_multilingual_example.py:148
↓ 1 callersFunctionbuild_ir_evaluator
Corpus = deduplicated passages of the split, queries = questions, 1:1 qrels.
examples/multi_vector_encoder/training/miriad/training_contrastive.py:51
↓ 1 callersFunctionbuild_kd
(corrupt: bool)
tests/multi_vector_encoder/losses/test_misc.py:423
↓ 1 callersFunctionbuild_pair_dataset
Build a dataset of (col_a, col_b, label) pairs with negatives.
examples/cross_encoder/training/multimodal/training_doodles_feature_extraction.py:133
↓ 1 callersFunctionbuild_pair_dataset
Build a dataset of (col_a, col_b, label) pairs with negatives.
examples/cross_encoder/training/multimodal/training_doodles_any_to_any.py:116
↓ 1 callersFunctionbuild_parser
()
skills/train-sentence-transformers/scripts/mine_hard_negatives.py:83
↓ 1 callersFunctionbuild_stacked
(model: nn.Module, inner: nn.Module)
tests/multi_vector_encoder/losses/test_token_pooling.py:174
↓ 1 callersMethodcalculate_loss
Compute the margin loss over the whole batch, from the per-mini-batch embeddings. The labels are unused: the negatives are mined from the oth
sentence_transformers/sentence_transformer/losses/mega_batch_margin.py:144
↓ 1 callersMethodcalculate_loss
(self, logits: Tensor, batch_size: int)
sentence_transformers/cross_encoder/losses/multiple_negatives_ranking.py:157
↓ 1 callersMethodcalculate_loss
Compute the loss over the whole batch, from the per-mini-batch embeddings. When ``with_backward`` is set, back-propagate the loss (chunk by c
sentence_transformers/base/losses/gradcache.py:428
↓ 1 callersMethodcalculate_loss_and_cache_gradients
Calculate the cross-entropy loss and return it alongside the gradients wrt. the embeddings.
sentence_transformers/sentence_transformer/losses/cached_gist_embed.py:243
↓ 1 callersMethodcalculate_loss_and_cache_gradients
( self, reps: list[list[Tensor]], masks_chunks: list[list[Tensor]], )
sentence_transformers/multi_vector_encoder/losses/cached_multiple_negatives_ranking.py:271
↓ 1 callersMethodcalculate_loss_and_cache_gradients
Calculate the cross-entropy loss and return it alongside the gradients wrt. the logits.
sentence_transformers/cross_encoder/losses/cached_multiple_negatives_ranking.py:221
↓ 1 callersMethodcall_grow_cache
Temporarily sets the output_hidden_states to True, runs the model, and then restores the original setting. Use the all_layer_embeddin
sentence_transformers/sentence_transformer/losses/adaptive_layer.py:41
↓ 1 callersMethodcall_model_init
(self, trial=None)
sentence_transformers/base/trainer.py:415
↓ 1 callersMethodcall_model_with_columns
( self, anchors: list[str], candidates: list[str], prompt: str | None = None, task: str | None = None
sentence_transformers/cross_encoder/losses/multiple_negatives_ranking.py:114
↓ 1 callersMethodcall_model_with_pairs
( self, pairs: list[list[str]], prompt: str | None = None, task: str | None = None )
sentence_transformers/cross_encoder/losses/multiple_negatives_ranking.py:120
↓ 1 callersMethodcall_use_cache
(self, features: dict[str, Tensor])
sentence_transformers/sentence_transformer/losses/adaptive_layer.py:57
↓ 1 callersMethodcheck_peft_compatible_model
(self)
sentence_transformers/base/peft_mixin.py:40
↓ 1 callersFunctionchunked_padded_forward
Chunked forward for multi-vector models, returning ``(token_embeddings, attention_mask)``. The per-chunk outputs are re-padded to the widest chun
sentence_transformers/base/losses/merged_forward.py:150
↓ 1 callersMethodcollect_features
Turn the inputs from the dataloader into the separate model inputs & the labels.
sentence_transformers/cross_encoder/trainer.py:180
↓ 1 callersMethodcollect_features
Turn the inputs from the dataloader into the separate model inputs & the labels. Example:: >>> list(inputs.keys()) [
sentence_transformers/base/trainer.py:588
↓ 1 callersMethodcompute_all_metrics
( self, model: SentenceTransformer, corpus_model=None, corpus_embeddings: Tens
sentence_transformers/sentence_transformer/evaluation/information_retrieval.py:325
↓ 1 callersFunctioncompute_count_vector
Compute count vector from sparse embeddings indicating how many samples have non-zero values in each dimension. Args: embeddings: Sp
sentence_transformers/util/tensor.py:388
↓ 1 callersMethodcompute_dcg_at_k
(relevances, k)
sentence_transformers/sentence_transformer/evaluation/information_retrieval.py:610
↓ 1 callersMethodcompute_loss_from_embeddings
(self, embeddings: list[Tensor], labels: Tensor)
sentence_transformers/sentence_transformer/losses/multiple_negatives_ranking.py:237
↓ 1 callersMethodcompute_loss_from_embeddings
(self, embeddings: list[Tensor], labels: Tensor)
sentence_transformers/sentence_transformer/losses/online_contrastive.py:82
↓ 1 callersMethodcompute_loss_from_embeddings
(self, embeddings: list[Tensor], labels: Tensor)
sentence_transformers/sentence_transformer/losses/contrastive.py:103
↓ 1 callersMethodcompute_loss_from_embeddings
(self, embeddings: list[Tensor], labels: Tensor)
sentence_transformers/sentence_transformer/losses/margin_mse.py:179
↓ 1 callersMethodcompute_loss_from_embeddings
Compute the GOR loss from pre-computed embeddings. Args: embeddings: List of embedding tensors, one for each input colum
sentence_transformers/sentence_transformer/losses/global_orthogonal_regularization.py:140
↓ 1 callersMethodcompute_loss_from_embeddings
Compute the CosineSimilarity loss from embeddings. Args: embeddings: List of embeddings labels: Labels indic
sentence_transformers/sentence_transformer/losses/cosine_similarity.py:84
↓ 1 callersMethodcompute_loss_from_embeddings
( self, embeddings: list[torch.Tensor], labels: torch.Tensor | None )
sentence_transformers/sentence_transformer/losses/angle.py:91
← previousnext →701–800 of 4,575, ranked by callers