backprop.models.t5_qa_summary_emotion

backprop.models.t5_qa_summary_emotion.model

class T5QASummaryEmotion(model_path=None, name: Optional[str] = None, description: Optional[str] = None, details: Optional[Dict] = None, tasks: Optional[List[str]] = None, device=None)[source]

Bases: backprop.models.hf_seq2seq_tg_model.model.HFSeq2SeqTGModel

Initialises a T5 model that has been finetuned on qa, summarisation and emotion detection.

model_path

path to an appropriate T5 model on huggingface (kiri-ai/t5-base-qa-summary-emotion)

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

device

Device for model. Defaults to “cuda” if available.

__call__(task_input, task='text-generation')[source]

Uses the model for the chosen task

Parameters
  • task_input – input dictionary according to the chosen task’s specification

  • task – one of text-generation, emotion, summarisation, qa

emote_or_summary(text, task_prefix, **gen_kwargs)[source]
encode_input(inp, max_length)[source]
encode_output(out, max_length)[source]
static list_models()[source]
process_batch(params, task)[source]
process_qa(question, context, prev_qa)[source]
qa(question, context, prev_qa: List[Tuple[str, str]] = [])[source]
training: bool
training_step(task_input)[source]

backprop.models.t5_qa_summary_emotion.models_list