File size: 1,220 Bytes
049ab2d
 
 
 
 
 
 
414c7fb
 
6ecf764
c9a8f43
 
b3d1621
c9a8f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6067822
c9a8f43
c995abc
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
license: mit
language:
- it
base_model:
- GroNLP/gpt2-small-italian
pipeline_tag: text-generation
tags:
- legal
library_name: transformers
---

## Usage
```
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("VerbACxSS/sempl-it-gpt2-small-italian", model_max_length=1024)
model = AutoModelForCausalLM.from_pretrained("VerbACxSS/sempl-it-gpt2-small-italian")

model.eval()

text_to_simplify = 'Nella fattispecie, questo documento è di natura prescrittiva'
prompt = f'### [Input]:\n{text_to_simplify}\n\n###[Output]:\n'

x = tokenizer(prompt, max_length=1024, truncation=True, padding=True, return_tensors='pt').input_ids
y = model.generate(x, max_length=1024)[0]
y_dec = tokenizer.decode(y, max_length=1024, truncation=True)
output = y_dec.split('###[Output]:\n')[1].split('<|endoftext|>')[0].strip()

print(output)
```

## Acknowledgements
This contribution is a result of the research conducted within the framework of the PRIN 2020 (Progetti di Rilevante Interesse Nazionale) "VerbACxSS: on analytic verbs, complexity, synthetic verbs, and simplification. For accessibility" (Prot. 2020BJKB9M), funded by the Italian Ministero dell'Università e della Ricerca.