Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,23 @@ base_model:
|
|
7 |
pipeline_tag: text2text-generation
|
8 |
tags:
|
9 |
- legal
|
10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
pipeline_tag: text2text-generation
|
8 |
tags:
|
9 |
- legal
|
10 |
+
---
|
11 |
+
|
12 |
+
## Usage
|
13 |
+
```
|
14 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
15 |
+
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained("VerbACxSS/sempl-it-mt5-small")
|
17 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("VerbACxSS/sempl-it-mt5-small")
|
18 |
+
|
19 |
+
model.eval()
|
20 |
+
|
21 |
+
text_to_simplify = 'Nella fattispecie, questo documento è di natura prescrittiva'
|
22 |
+
prompt = f'semplifica: {text_to_simplify}'
|
23 |
+
|
24 |
+
x = tokenizer(prompt, max_length=1024, truncation=True, padding=True, return_tensors='pt').input_ids
|
25 |
+
y = model.generate(x, max_length=1024)[0]
|
26 |
+
output = tokenizer.decode(y, max_length=1024, truncation=True, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
27 |
+
|
28 |
+
print(output)
|
29 |
+
```
|