mys commited on
Commit
d47c273
1 Parent(s): 32a0eef

Add usage example

Browse files
Files changed (1) hide show
  1. README.md +24 -1
README.md CHANGED
@@ -1,5 +1,28 @@
1
  ## Overview
2
- This model is a finetuned version of [mt5-small](https://huggingface.co/google/mt5-small) for question paraphrasing task in Turkish. As a generator model, its capabiities are currently investigated and there is an ongoing effort to further improve it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  ## Dataset
5
  I used [TQP dataset V0.1](https://github.com/monatis/tqp) that I've published just recently. This model should be taken as as a baseline model for TQP dataset. A cleaning and further improvements in the dataset and an elaborate hyperparameter tuning may boost the performance.
1
  ## Overview
2
+ This model is a finetuned version of [mt5-small](https://huggingface.co/google/mt5-small) for question paraphrasing task in Turkish. As a generator model, its capabilities are currently investigated and there is an ongoing effort to further improve it.
3
+
4
+ ## Usage
5
+ You can generate 5 paraphrases for the input question with The simple code below.
6
+
7
+ ```python
8
+ from transformers import AutoTokenizer, T5ForConditionalGeneration
9
+ model_name = "mys/mt5-small-turkish-question-paraphrasing"
10
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
11
+ model = T5ForConditionalGeneration.from_pretrained(model_name)
12
+
13
+ tokens = tokenizer.encode_plus("Yarın toplantı kaçta başlıyor?", return_tensors='pt')
14
+ paraphrases = model.generate(tokens['input_ids'], max_length=128, num_return_sequences=5, num_beams=5)
15
+ tokenizer.batch_decode(paraphrases, skip_special_tokens=True)
16
+ ```
17
+
18
+ And the output will be something like:
19
+ ```shell
20
+ ['Yarın toplantı ne zaman başlıyor?',
21
+ 'Yarın toplantı saat kaçta başlıyor?',
22
+ 'Yarın toplantı saat kaçta başlar?',
23
+ 'Yarın toplantı ne zaman başlayacak?',
24
+ 'Yarın toplantı ne zaman başlar?']
25
+ ```
26
 
27
  ## Dataset
28
  I used [TQP dataset V0.1](https://github.com/monatis/tqp) that I've published just recently. This model should be taken as as a baseline model for TQP dataset. A cleaning and further improvements in the dataset and an elaborate hyperparameter tuning may boost the performance.