Update README.md
Browse files
README.md
CHANGED
@@ -26,3 +26,27 @@ widget:
|
|
26 |
к своей мечте.
|
27 |
example_title: Summarization Example 1
|
28 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
к своей мечте.
|
27 |
example_title: Summarization Example 1
|
28 |
---
|
29 |
+
|
30 |
+
Russian text summarizer was fine-tuned from ai-forever/ruT5-base model and trained on ~60k rows samples' dataset.
|
31 |
+
|
32 |
+
Example Usage:
|
33 |
+
|
34 |
+
```python
|
35 |
+
model_name = "sarahai/ruT5-base-summarizer"
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
37 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
38 |
+
|
39 |
+
device = torch.device("cpu") #if you are using cpu
|
40 |
+
|
41 |
+
input_text = "текст на русском" #your input in russian
|
42 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
43 |
+
outputs = model.generate(input_ids, max_length=100, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True) #change according to your preferences
|
44 |
+
summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
45 |
+
|
46 |
+
print(summary)
|
47 |
+
```
|
48 |
+
|
49 |
+
References
|
50 |
+
Hugging Face Model Hub
|
51 |
+
T5 Paper
|
52 |
+
Disclaimer: The model's performance may be influenced by the quality and representativeness of the data it was fine-tuned on. Users are encouraged to assess the model's suitability for their specific applications and datasets.
|