SentenceTransformer#

class sdm.processing.text.SentenceTransformer(model: str, postprocess: object = None, *, batch_size: int | None = 32, max_batch_tokens: int | None = 65536, max_length: int | None = None, show_progress: bool = True, device: device | str | None = None, dtype: dtype = torch.bfloat16)#

Bases: Processor

Embed text columns with a sentence_transformers.SentenceTransformer model.

Parameters:
  • model (str) – The model name of a sentence_transformers.SentenceTransformer.

  • postprocess (object) – Optional postprocessing routine, applied independently for each text column.

  • batch_size (int | None) – The maximum batch size of the model. Adjusting the batch size can significantly improve processing speed. The optimal value depends on your hardware, model size, precision, and input length.

  • max_batch_tokens (int | None) – The maximum number of tokens to process per batch.

  • max_length (int | None) – The maximum number of tokens per text before truncation.

  • show_progress (bool) – Whether to display a progress bar with token throughput.

  • device (torch.device | str | None) – The device.

  • dtype (torch.dtype) – The dtype.

Capabilities#

Handled Semantic Types

text

Requires Fitting

instance-specific