Update README.md
Browse files
README.md
CHANGED
@@ -21,14 +21,12 @@ This model was trained on a lfqa dataset. The model provide long-form answers to
|
|
21 |
|
22 |
```python
|
23 |
import torch
|
24 |
-
from transformers import AutoTokenizer,
|
25 |
|
26 |
model_name = "efederici/it5-small-lfqa"
|
27 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
28 |
|
29 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
30 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(
|
31 |
-
model = model.to(device)
|
32 |
|
33 |
query = "con chi si era messo in contatto elon musk?"
|
34 |
|
@@ -42,8 +40,8 @@ query_and_docs = f"Domanda: {query} Contesto: {doc}"
|
|
42 |
|
43 |
model_input = tokenizer(query_and_docs, truncation=True, padding=True, return_tensors="pt")
|
44 |
|
45 |
-
output = model.generate(input_ids=model_input["input_ids"]
|
46 |
-
attention_mask=model_input["attention_mask"]
|
47 |
min_length=10,
|
48 |
max_length=256,
|
49 |
do_sample=False,
|
|
|
21 |
|
22 |
```python
|
23 |
import torch
|
24 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
25 |
|
26 |
model_name = "efederici/it5-small-lfqa"
|
|
|
27 |
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained("efederici/it5-small-lfqa", from_flax=True)
|
29 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("efederici/it5-small-lfqa", from_flax=True)
|
|
|
30 |
|
31 |
query = "con chi si era messo in contatto elon musk?"
|
32 |
|
|
|
40 |
|
41 |
model_input = tokenizer(query_and_docs, truncation=True, padding=True, return_tensors="pt")
|
42 |
|
43 |
+
output = model.generate(input_ids=model_input["input_ids"],
|
44 |
+
attention_mask=model_input["attention_mask"],
|
45 |
min_length=10,
|
46 |
max_length=256,
|
47 |
do_sample=False,
|