backprop.models.st_model¶
backprop.models.st_model.model¶
-
class
STModel
(model_path, init_model=<class 'sentence_transformers.SentenceTransformer.SentenceTransformer'>, name: Optional[str] = None, description: Optional[str] = None, tasks: Optional[List[str]] = None, details: Optional[Dict] = None, max_length=512, device=None)[source]¶ Bases:
backprop.models.generic_models.PathModel
Class for models which are initialised from Sentence Transformers
-
model_path
¶ path to ST model
-
name
¶ string identifier for the model. Lowercase letters and numbers. No spaces/special characters except dashes.
-
max_length
¶ Max supported token length for vectorisation
-
description
¶ String description of the model.
-
tasks
¶ List of supported task strings
-
details
¶ Dictionary of additional details about the model
-
init_model
¶ Class used to initialise model
-
device
¶ Device for model. Defaults to “cuda” if available.
-
__call__
(task_input, task='text-vectorisation', return_tensor=False)[source]¶ Uses the model for the text-vectorisation task
- Parameters
task_input – input dictionary according to the
text-vectorisation
task specificationtask – text-vectorisation
-
training
: bool¶
-