flan-t5-emotions / README.md
dpetrak's picture
Update README.md
9324064 verified
|
raw
history blame
2.72 kB
metadata
inference:
  parameters:
    max_new_tokens: 65
license: apache-2.0
language:
  - en
metrics:
  - bleu
  - f1
  - perplexity
widget:
  - text: >-
      <knowledge> Yes. You need to notify POSTE assicura. <user_persona> 
      <gender> female <age> 30 and 45 <job> cartographer <name> Joanna
      <language> form <dialog> <user> Good evening, can you clarify what types
      of people can't be  insured with Poste Assicura, as stated in document_0?
      <system> Certainly, according to document_0, people who are or have been 
      affected by alcoholism, drug addiction, and HIV infection with or without
      AIDS cannot be insured. <user> What happens if I am  currently a
      policyholder with Poste Assicura and I develop alcoholism? Do I need to
      notify them? <intent>

Model Card for Flan-T5 Large Personas

This is a Flan-T5-large based model finetuned on the POSTE tasks using only the persona data as additional input signals. For signals that are not available, please add the respective tag nonetheless. Consider the example from the inference API on the right as a starting point.

Regarding the Output of the inference widget on the right: I just shows that the model can be load and how the input should look like. The generation might look a bit weird, since it contains the predicted intent, the slots, and the model response, but the inference api removes all special tokens during postprocessing.

Model Sources

How to Get Started with the Model

import torch
from transformers import (AutoModelForSeq2SeqLM, 
                          AutoTokenizer)

torch_device = "cuda" if torch.cuda.is_available() else "cpu"

tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSeq2SeqLM.from_pretrained(model_path,
  pad_token_id=tokenizer.eos_token_id).to(torch_device)

input = """<knowledge> <user_persona> <gender> <age> <job> <name> <language>
  <dialog> <user> Hi, I need help with parcel choice. Can you do that? <intent>"""

input_enc = tokenizer.encode(input,
  truncation = True,
  return_tensors='pt').to(torch_device))

output = model.generate(model_inputs, generation_config, max_new_tokens=75)
output_dec = tokenizer.decode(output[0])

'''The output should look like <intent> ... <slots> ... <system> ...'''

special_toks = r'<intent>|<slots>|<system>'
special_toks = re.findall(special_toks, output)
splits = re.split(special_toks, output)[1:]

for special_tok, text in zip(special_toks, splits):
  if len(text) > 0:
    print(f'{special_tok}: {text}')