backprop.models.hf_causallm_tg_model

backprop.models.hf_causallm_tg_model.model

class HFCausalLMTGModel(model_path=None, tokenizer_path=None, name: Optional[str] = None, description: Optional[str] = None, details: Optional[Dict] = None, tasks: Optional[List[str]] = None, model_class=<class 'transformers.models.auto.modeling_auto.AutoModelForCausalLM'>, tokenizer_class=<class 'transformers.models.auto.tokenization_auto.AutoTokenizer'>, device=None)[source]

Bases: backprop.models.generic_models.HFTextGenerationModel

Class for Hugging Face causal LM models

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-generation')[source]

Uses the model for the text-generation task

Parameters
  • task_input – input dictionary according to the text-generation task specification.

  • task – text-generation

static list_models()[source]
training: bool

backprop.models.hf_causallm_tg_model.models_list