Model Card for Flan-T5 Large Emotions
This is a Flan-T5-large based model finetuned on the POSTE tasks using only the emotion 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
- Repository: Flan-T5-large
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_emotion> <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}')
- Downloads last month
- 184
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.