Update README.md
Browse files
README.md
CHANGED
|
@@ -12,197 +12,58 @@ widget:
|
|
| 12 |
- text: "سید ابراهیم رییسی در سال <mask> رییس جمهور ایران شد."
|
| 13 |
- text: "دیگر امکان ادامه وجود ندارد. باید قرارداد را <mask> کنیم."
|
| 14 |
---
|
| 15 |
-
# Model
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 31 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 32 |
-
- **Model type:** [More Information Needed]
|
| 33 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 34 |
-
- **License:** [More Information Needed]
|
| 35 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 36 |
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
-
|
| 42 |
-
- **Paper [optional]:** [More Information Needed]
|
| 43 |
-
- **Demo [optional]:** [More Information Needed]
|
| 44 |
-
|
| 45 |
-
## Uses
|
| 46 |
-
|
| 47 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 48 |
-
|
| 49 |
-
### Direct Use
|
| 50 |
-
|
| 51 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 52 |
-
|
| 53 |
-
[More Information Needed]
|
| 54 |
-
|
| 55 |
-
### Downstream Use [optional]
|
| 56 |
-
|
| 57 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 58 |
-
|
| 59 |
-
[More Information Needed]
|
| 60 |
-
|
| 61 |
-
### Out-of-Scope Use
|
| 62 |
-
|
| 63 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 64 |
-
|
| 65 |
-
[More Information Needed]
|
| 66 |
-
|
| 67 |
-
## Bias, Risks, and Limitations
|
| 68 |
-
|
| 69 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 70 |
-
|
| 71 |
-
[More Information Needed]
|
| 72 |
-
|
| 73 |
-
### Recommendations
|
| 74 |
-
|
| 75 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 76 |
-
|
| 77 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 78 |
-
|
| 79 |
-
## How to Get Started with the Model
|
| 80 |
-
|
| 81 |
-
Use the code below to get started with the model.
|
| 82 |
-
|
| 83 |
-
[More Information Needed]
|
| 84 |
-
|
| 85 |
-
## Training Details
|
| 86 |
-
|
| 87 |
-
### Training Data
|
| 88 |
-
|
| 89 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 90 |
-
|
| 91 |
-
[More Information Needed]
|
| 92 |
-
|
| 93 |
-
### Training Procedure
|
| 94 |
-
|
| 95 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 96 |
-
|
| 97 |
-
#### Preprocessing [optional]
|
| 98 |
-
|
| 99 |
-
[More Information Needed]
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
#### Training Hyperparameters
|
| 103 |
-
|
| 104 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 105 |
-
|
| 106 |
-
#### Speeds, Sizes, Times [optional]
|
| 107 |
-
|
| 108 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 109 |
-
|
| 110 |
-
[More Information Needed]
|
| 111 |
|
| 112 |
## Evaluation
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
### Testing Data, Factors & Metrics
|
| 117 |
-
|
| 118 |
-
#### Testing Data
|
| 119 |
-
|
| 120 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 121 |
-
|
| 122 |
-
[More Information Needed]
|
| 123 |
-
|
| 124 |
-
#### Factors
|
| 125 |
-
|
| 126 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 127 |
-
|
| 128 |
-
[More Information Needed]
|
| 129 |
-
|
| 130 |
-
#### Metrics
|
| 131 |
-
|
| 132 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 133 |
-
|
| 134 |
-
[More Information Needed]
|
| 135 |
-
|
| 136 |
-
### Results
|
| 137 |
-
|
| 138 |
-
[More Information Needed]
|
| 139 |
-
|
| 140 |
-
#### Summary
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
## Model Examination [optional]
|
| 145 |
-
|
| 146 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 147 |
-
|
| 148 |
-
[More Information Needed]
|
| 149 |
-
|
| 150 |
-
## Environmental Impact
|
| 151 |
-
|
| 152 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 153 |
-
|
| 154 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 155 |
-
|
| 156 |
-
- **Hardware Type:** [More Information Needed]
|
| 157 |
-
- **Hours used:** [More Information Needed]
|
| 158 |
-
- **Cloud Provider:** [More Information Needed]
|
| 159 |
-
- **Compute Region:** [More Information Needed]
|
| 160 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 161 |
-
|
| 162 |
-
## Technical Specifications [optional]
|
| 163 |
-
|
| 164 |
-
### Model Architecture and Objective
|
| 165 |
-
|
| 166 |
-
[More Information Needed]
|
| 167 |
-
|
| 168 |
-
### Compute Infrastructure
|
| 169 |
-
|
| 170 |
-
[More Information Needed]
|
| 171 |
-
|
| 172 |
-
#### Hardware
|
| 173 |
-
|
| 174 |
-
[More Information Needed]
|
| 175 |
-
|
| 176 |
-
#### Software
|
| 177 |
-
|
| 178 |
-
[More Information Needed]
|
| 179 |
-
|
| 180 |
-
## Citation [optional]
|
| 181 |
-
|
| 182 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 183 |
-
|
| 184 |
-
**BibTeX:**
|
| 185 |
-
|
| 186 |
-
[More Information Needed]
|
| 187 |
-
|
| 188 |
-
**APA:**
|
| 189 |
-
|
| 190 |
-
[More Information Needed]
|
| 191 |
-
|
| 192 |
-
## Glossary [optional]
|
| 193 |
-
|
| 194 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 195 |
-
|
| 196 |
-
[More Information Needed]
|
| 197 |
-
|
| 198 |
-
## More Information [optional]
|
| 199 |
-
|
| 200 |
-
[More Information Needed]
|
| 201 |
-
|
| 202 |
-
## Model Card Authors [optional]
|
| 203 |
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
-
|
| 207 |
|
| 208 |
-
|
|
|
|
| 12 |
- text: "سید ابراهیم رییسی در سال <mask> رییس جمهور ایران شد."
|
| 13 |
- text: "دیگر امکان ادامه وجود ندارد. باید قرارداد را <mask> کنیم."
|
| 14 |
---
|
| 15 |
+
# Model Details
|
| 16 |
|
| 17 |
+
TukaBERT models are a family of encoder models trained on Persian in two sizes of base and large.
|
| 18 |
+
These Models pre-trained on over 300GB Persian data including variety of topics such as News, Blogs, Forums,
|
| 19 |
+
Books, etc. They were pre-training with the MLM (WWM) objective using two context lengths.
|
| 20 |
|
| 21 |
+
## How to use
|
| 22 |
|
| 23 |
+
You can use this model directly for Masked Language Modeling using the provided code below.
|
| 24 |
|
| 25 |
+
```Python
|
| 26 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 27 |
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained("PartAI/PartBert-Base")
|
| 29 |
+
model = AutoModelForMaskedLM.from_pretrained("PartAI/PartBert-Base")
|
| 30 |
|
| 31 |
+
# prepare input
|
| 32 |
+
text = "شهر برلین در کشور <mask> واقع شده است."
|
| 33 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 34 |
|
| 35 |
+
# forward pass
|
| 36 |
+
output = model(**encoded_input)
|
| 37 |
+
```
|
| 38 |
|
| 39 |
+
It is also possible to use inference pipelines such as below.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
```Python
|
| 42 |
+
from transformers import pipeline
|
| 43 |
|
| 44 |
+
inference_pipeline = pipeline('fill-mask', model="PartAI/PartBert-Base")
|
| 45 |
+
inference_pipeline("شهر برلین در کشور <mask> واقع شده است.")
|
| 46 |
+
```
|
| 47 |
|
| 48 |
+
You can use this model to fine-tune it over your dataset and prepare it for your task.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
## Evaluation
|
| 51 |
|
| 52 |
+
TukaBERT models are evaluated on a wide range of NLP downstream tasks, such as Sentiment Analysis (SA), Text Classification, Multiple-choice, Question Answering, and Named Entity Recognition (NER).
|
| 53 |
+
Here are some key performance results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
| Model name | DeepSentiPers (f1/acc) | MultiCoNER-v2 (f1/acc) | PQuAD (best_exact/best_f1/HasAns_exact/HasAns_f1) | FarsTail (f1/acc) | ParsiNLU-Multiple-choice (f1/acc) | ParsiNLU-Reading-comprehension (exact/f1) | ParsiNLU-QQP (f1/acc) |
|
| 56 |
+
|------------------|------------------------|------------------------|---------------------------------------------------|-------------------|-----------------------------------|-------------------------------------------|-----------------------|
|
| 57 |
+
| TukaBERT-large | **85.66/85.78** | **69.69/94.07** | **75.56/88.06/70.24/87.83** | **89.71/89.72** | **36.13/35.97** | **33.6/60.5** | **82.72/82.63** |
|
| 58 |
+
| TukaBERT-base | _83.93/83.93_ | _66.23/93.3_ | _73.18_/_85.71_/_68.29_/_85.94_ | _83.26/83.41_ | 33.6/_33.81_ | 20.8/42.52 | _81.33/81.29_ |
|
| 59 |
+
| Shiraz | 81.17/81.08 | 59.1/92.83 | 65.96/81.25/59.63/81.31 | 77.76/77.75 | _34.73/34.53_ | 17.6/39.61 | 79.68/79.51 |
|
| 60 |
+
| ParsBERT | 80.22/80.23 | 64.91/93.23 | 71.41/84.21/66.29/84.57 | 80.89/80.94 | **35.34/35.25** | 20/39.58 | 80.15/80.07 |
|
| 61 |
+
| XLM-V-base | _83.43/83.36_ | 58.83/92.23 | _73.26_/_85.69_/_68.21_/_85.56_ | 81.1/81.2 | **35.28/35.25** | 8/26.66 | 80.1/79.96 |
|
| 62 |
+
| XLM-RoBERTa-base | _83.99/84.07_ | 60.38/92.49 | _73.72_/_86.24_/_68.16_/_85.8_ | 82.0/81.98 | 32.4/32.37 | 20.0/40.43 | 79.14/78.95 |
|
| 63 |
+
| FaBERT | 82.68/82.65 | 63.89/93.01 | _72.57_/_85.39_/67.16/_85.31_ | _83.69/83.67_ | 32.47/32.37 | _27.2/48.42_ | **82.34/82.29** |
|
| 64 |
+
| mBERT | 78.57/78.66 | 60.31/92.54 | 71.79/84.68/65.89/83.99 | _82.69/82.82_ | 33.41/33.09 | _27.2_/42.18 | 79.19/79.29 |
|
| 65 |
+
| AriaBERT | 80.51/80.51 | 60.98/92.45 | 68.09/81.23/62.12/80.94 | 74.47/74.43 | 30.75/30.94 | 14.4/35.48 | 79.09/78.84 |
|
| 66 |
|
| 67 |
+
\*Note because of the randomness in the fine-tuning process, results with less than 1% differences are italic together.
|
| 68 |
|
| 69 |
+
## How to Cite
|