backprop.models.hf_nli_model¶
backprop.models.hf_nli_model.model¶
-
class
HFNLIModel(model_path=None, tokenizer_path=None, name: Optional[str] = None, description: Optional[str] = None, tasks: Optional[List[str]] = None, details: Optional[Dict] = None, model_class=<class 'transformers.models.auto.modeling_auto.AutoModelForSequenceClassification'>, tokenizer_class=<class 'transformers.models.auto.tokenization_auto.AutoTokenizer'>, device=None)[source]¶ Bases:
backprop.models.generic_models.HFModelClass for Hugging Face sequence classification models trained on a NLI dataset
-
model_path¶ path to HF model
-
tokenizer_path¶ path to HF tokenizer
-
name¶ string identifier for the model. Lowercase letters and numbers. No spaces/special characters except dashes.
-
description¶ String description of the model.
-
tasks¶ List of supported task strings
-
details¶ Dictionary of additional details about the model
-
model_class¶ Class used to initialise model
-
tokenizer_class¶ Class used to initialise tokenizer
-
device¶ Device for model. Defaults to “cuda” if available.
-
__call__(task_input, task='text-classification')[source]¶ Uses the model for the text-classification task
- Parameters
task_input – input dictionary according to the
text-classificationtask specification. Needs labels (for zero-shot).task – text-classification
-
training: bool¶
-