oOundefinedOo
commited on
Commit
•
cfd62d2
1
Parent(s):
6c5fea7
Update README.md
Browse files
README.md
CHANGED
@@ -12,6 +12,13 @@ base_model:
|
|
12 |
|
13 |
## Пример использования:
|
14 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
def generate_answer(question: str, context: str) -> str:
|
16 |
|
17 |
input_text = f"question: {question} context: {context}"
|
@@ -20,5 +27,5 @@ def generate_answer(question: str, context: str) -> str:
|
|
20 |
outputs = model.generate(input_ids)
|
21 |
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
22 |
|
23 |
-
return answer
|
24 |
```
|
|
|
12 |
|
13 |
## Пример использования:
|
14 |
```python
|
15 |
+
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
16 |
+
|
17 |
+
|
18 |
+
model = T5ForConditionalGeneration.from_pretrained("path_to_folder", use_safetensors=True)
|
19 |
+
tokenizer = T5Tokenizer.from_pretrained("path_to_folder")
|
20 |
+
|
21 |
+
|
22 |
def generate_answer(question: str, context: str) -> str:
|
23 |
|
24 |
input_text = f"question: {question} context: {context}"
|
|
|
27 |
outputs = model.generate(input_ids)
|
28 |
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
29 |
|
30 |
+
return answer
|
31 |
```
|