FNP_T5_D2T_simple / Readme.md
dmariko's picture
init
cf9fc78
|
raw
history blame
1.78 kB

T5-base data to text model specialized for Finance NLG

simple version


Usage (HuggingFace Transformers)

Call the model

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
  
tokenizer = AutoTokenizer.from_pretrained("yseop/FNP_T5_D2T_complete")

model = AutoModelForSeq2SeqLM.from_pretrained("yseop/FNP_T5_D2T_complete")


text = ["Group profit | valIs | € 115.7 million && € 115.7 million | dTime | in 2019"]

Choose a generation method



input_ids = tokenizer.encode(": {}".format(text), return_tensors="pt")
p=0.72
k=40

outputs = model.generate(input_ids,
                         do_sample=True,
                        top_p=p,
                        top_k=k,
                        early_stopping=True)

print(tokenizer.decode(outputs[0]))

input_ids = tokenizer.encode(": {}".format(text), return_tensors="pt")

outputs = model.generate(input_ids, 
                         max_length=200, 
                         num_beams=2, repetition_penalty=2.5, 
                         top_k=50, top_p=0.98,
                         length_penalty=1.0,
                         early_stopping=True)

print(tokenizer.decode(outputs[0]))

@inproceedings{Mariko-fincausal-2021, title ={{The Financial Document Causality Detection Shared Task (FinCausal 2021)}}, author = {Mariko, Dominique and Abi Akl, Hanna and Labidurie, Estelle and de Mazancourt, Hugues and El-Haj, Mahmoud}, booktitle ={{The Third Financial Narrative Processing Workshop (FNP 2021)}}, year = {2021}, address = {Lancaster, UK} }

Created by: Yseop | Pioneer in Natural Language Generation (NLG) technology. Scaling human expertise through Natural Language Generation.