torch_geometric.llm.models.SentenceTransformer
- class SentenceTransformer(model_name: str, pooling_strategy: Union[PoolingStrategy, str] = 'mean')[source]
Bases:
Module
A wrapper around a Sentence-Transformer from HuggingFace.
- Parameters:
- max_seq_length
Some models define a max sequence length in their configuration. Others only in the tokenizer. This is a hacky heuristic to find the max sequence length that works for the model.
- forward(input_ids: Tensor, attention_mask: Tensor) Tensor [source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type: