julien-c HF staff commited on
Commit
6632c3e
1 Parent(s): 14bcd88

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/surajp/RoBERTa-hindi-guj-san/README.md

Files changed (1) hide show
  1. README.md +107 -0
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - hi
4
+ - sa
5
+ - gu
6
+ tags:
7
+ - Indic
8
+ license: mit
9
+ datasets:
10
+ - Wikipedia (Hindi, Sanskrit, Gujarati)
11
+ metrics:
12
+ - perplexity
13
+ ---
14
+
15
+ # RoBERTa-hindi-guj-san
16
+
17
+ ## Model description
18
+
19
+ Multillingual RoBERTa like model trained on Wikipedia articles of Hindi, Sanskrit, Gujarati languages. The tokenizer was trained on combined text.
20
+ However, Hindi text was used to pre-train the model and then it was fine-tuned on Sanskrit and Gujarati Text combined hoping that pre-training with Hindi
21
+ will help the model learn similar languages.
22
+
23
+ ### Configuration
24
+
25
+ | Parameter | Value |
26
+ |---|---|
27
+ | `hidden_size` | 768 |
28
+ | `num_attention_heads` | 12 |
29
+ | `num_hidden_layers` | 6 |
30
+ | `vocab_size` | 30522 |
31
+ |`model_type`|`roberta`|
32
+
33
+ ## Intended uses & limitations
34
+
35
+ #### How to use
36
+
37
+ ```python
38
+ # Example usage
39
+ from transformers import AutoTokenizer, AutoModelWithLMHead, pipeline
40
+
41
+ tokenizer = AutoTokenizer.from_pretrained("surajp/RoBERTa-hindi-guj-san")
42
+ model = AutoModelWithLMHead.from_pretrained("surajp/RoBERTa-hindi-guj-san")
43
+
44
+ fill_mask = pipeline(
45
+ "fill-mask",
46
+ model=model,
47
+ tokenizer=tokenizer
48
+ )
49
+
50
+ # Sanskrit: इयं भाषा न केवलं भारतस्य अपि तु विश्वस्य प्राचीनतमा भाषा इति मन्यते।
51
+ # Hindi: अगर आप अब अभ्यास नहीं करते हो तो आप अपने परीक्षा में मूर्खतापूर्ण गलतियाँ करोगे।
52
+ # Gujarati: ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો <mask> હતો.
53
+ fill_mask("ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો <mask> હતો.")
54
+
55
+ '''
56
+ Output:
57
+ --------
58
+ [
59
+ {'score': 0.07849744707345963, 'sequence': '<s> ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો જ હતો.</s>', 'token': 390},
60
+ {'score': 0.06273336708545685, 'sequence': '<s> ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો ન હતો.</s>', 'token': 478},
61
+ {'score': 0.05160355195403099, 'sequence': '<s> ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો થઇ હતો.</s>', 'token': 2075},
62
+ {'score': 0.04751499369740486, 'sequence': '<s> ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો એક હતો.</s>', 'token': 600},
63
+ {'score': 0.03788900747895241, 'sequence': '<s> ગુજરાતમાં ૧૯મી માર્ચ સુધી કોઈ સકારાત્મક (પોઝીટીવ) રીપોર્ટ આવ્યો પણ હતો.</s>', 'token': 840}
64
+ ]
65
+
66
+ ```
67
+
68
+ ## Training data
69
+
70
+ Cleaned wikipedia articles in Hindi, Sanskrit and Gujarati on Kaggle. It contains training as well as evaluation text.
71
+ Used in [iNLTK](https://github.com/goru001/inltk)
72
+
73
+ - [Hindi](https://www.kaggle.com/disisbig/hindi-wikipedia-articles-172k)
74
+ - [Gujarati](https://www.kaggle.com/disisbig/gujarati-wikipedia-articles)
75
+ - [Sanskrit](https://www.kaggle.com/disisbig/sanskrit-wikipedia-articles)
76
+
77
+ ## Training procedure
78
+
79
+ - On TPU (using `xla_spawn.py`)
80
+ - For language modelling
81
+ - Iteratively increasing `--block_size` from 128 to 256 over epochs
82
+ - Tokenizer trained on combined text
83
+ - Pre-training with Hindi and fine-tuning on Sanskrit and Gujarati texts
84
+
85
+ ```
86
+ --model_type distillroberta-base \
87
+ --model_name_or_path "/content/SanHiGujBERTa" \
88
+ --mlm_probability 0.20 \
89
+ --line_by_line \
90
+ --save_total_limit 2 \
91
+ --per_device_train_batch_size 128 \
92
+ --per_device_eval_batch_size 128 \
93
+ --num_train_epochs 5 \
94
+ --block_size 256 \
95
+ --seed 108 \
96
+ --overwrite_output_dir \
97
+ ```
98
+
99
+ ## Eval results
100
+
101
+ perplexity = 2.920005983224673
102
+
103
+
104
+
105
+ > Created by [Suraj Parmar/@parmarsuraj99](https://twitter.com/parmarsuraj99) | [LinkedIn](https://www.linkedin.com/in/parmarsuraj99/)
106
+
107
+ > Made with <span style="color: #e25555;">&hearts;</span> in India