Kirill Gelvan commited on
Commit
455b203
1 Parent(s): 1f5f0c4

major update with code

Browse files
Files changed (1) hide show
  1. README.md +45 -1
README.md CHANGED
@@ -6,7 +6,9 @@ tags:
6
  - mbart
7
  inference:
8
  parameters:
9
- no_repeat_ngram_size: 4
 
 
10
  datasets:
11
  - IlyaGusev/gazeta
12
  - samsum
@@ -44,3 +46,45 @@ model-index:
44
  value: 28
45
  ---
46
  ### 📝 Description
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - mbart
7
  inference:
8
  parameters:
9
+ no_repeat_ngram_size: 4,
10
+ top_k : 0,
11
+ num_beams : 5,
12
  datasets:
13
  - IlyaGusev/gazeta
14
  - samsum
 
46
  value: 28
47
  ---
48
  ### 📝 Description
49
+
50
+ MBart for Russian summarization fine-tuned for **dialogues** summarization.
51
+
52
+
53
+ This model was firstly fine-tuned by [Ilya Gusev](https://hf.co/IlyaGusev) on [Gazeta dataset](https://huggingface.co/datasets/IlyaGusev/gazeta). We have **fine tuned** that model on [SamSum dataset]() **translated to Russian** using GoogleTranslateAPI.
54
+
55
+ ⚠️ Due to specifics of the data Hosted inference API may not work properly ⚠️
56
+
57
+ 🤗 Moreover! We have implemented a **! telegram bot [@summarization_bot](https://t.me/summarization_bot) !** with the inference of this model. Add it to the chat and get summaries instead of dozens spam messages!  🤗
58
+
59
+
60
+ ### ❓ How to use with code
61
+ ```python
62
+ from transformers import MBartTokenizer, MBartForConditionalGeneration
63
+
64
+ # Download model and tokenizer
65
+ model_name = "Kirili4ik/mbart_ruDialogSum"
66
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
67
+ model = MBartForConditionalGeneration.from_pretrained(model_name)
68
+ model.eval()
69
+
70
+ article_text = "..."
71
+
72
+ input_ids = tokenizer(
73
+ [article_text],
74
+ max_length=600,
75
+ padding="max_length",
76
+ truncation=True,
77
+ return_tensors="pt",
78
+ )["input_ids"]
79
+
80
+ output_ids = model.generate(
81
+ input_ids=input_ids,
82
+ top_k=0,
83
+ num_beams=3,
84
+ no_repeat_ngram_size=3
85
+ )[0]
86
+
87
+
88
+ summary = tokenizer.decode(output_ids, skip_special_tokens=True)
89
+ print(summary)
90
+ ```