Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
# T5 data to text model specialized for Finance NLG
|
4 |
+
|
5 |
+
----
|
6 |
+
## Usage (HuggingFace Transformers)
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
#### Call the model
|
11 |
+
|
12 |
+
```python
|
13 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
14 |
+
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained("yseop/FNP_T5_D2T_complete")
|
16 |
+
|
17 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("yseop/FNP_T5_D2T_complete")
|
18 |
+
|
19 |
+
|
20 |
+
text = ["Group profit | valIs | € 115.7 million && € 115.7 million | dTime | in 2019"]
|
21 |
+
|
22 |
+
```
|
23 |
+
#### Choose a generation method
|
24 |
+
|
25 |
+
```python
|
26 |
+
|
27 |
+
|
28 |
+
input_ids = tokenizer.encode(": {}".format(text), return_tensors="pt")
|
29 |
+
p=0.72
|
30 |
+
k=40
|
31 |
+
|
32 |
+
outputs = model.generate(input_ids,
|
33 |
+
do_sample=True,
|
34 |
+
top_p=p,
|
35 |
+
top_k=k,
|
36 |
+
early_stopping=True)
|
37 |
+
|
38 |
+
print(tokenizer.decode(outputs[0]))
|
39 |
+
|
40 |
+
```
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
```python
|
45 |
+
|
46 |
+
input_ids = tokenizer.encode(": {}".format(text), return_tensors="pt")
|
47 |
+
|
48 |
+
outputs = model.generate(input_ids,
|
49 |
+
max_length=200,
|
50 |
+
num_beams=2, repetition_penalty=2.5,
|
51 |
+
top_k=50, top_p=0.98,
|
52 |
+
length_penalty=1.0,
|
53 |
+
early_stopping=True)
|
54 |
+
|
55 |
+
print(tokenizer.decode(outputs[0]))
|
56 |
+
|
57 |
+
|
58 |
+
```
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
**Created by:** [Yseop](https://www.yseop.com/) | Pioneer in Natural Language Generation (NLG) technology. Scaling human expertise through Natural Language Generation.
|