nesemenpolkov
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -5,199 +5,93 @@ tags:
|
|
5 |
- msu
|
6 |
- wiki
|
7 |
- fine-tuned
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
# Model Card for Model ID
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
## Model Details
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
-
|
23 |
|
24 |
-
- **Developed by:** [More Information Needed]
|
25 |
-
- **Funded by [optional]:** [More Information Needed]
|
26 |
-
- **Shared by [optional]:** [More Information Needed]
|
27 |
-
- **Model type:** [More Information Needed]
|
28 |
-
- **Language(s) (NLP):** [More Information Needed]
|
29 |
-
- **License:** [More Information Needed]
|
30 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
- **Demo [optional]:** [More Information Needed]
|
39 |
|
40 |
-
|
|
|
41 |
|
42 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
|
|
|
|
57 |
|
58 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
59 |
-
|
60 |
-
[More Information Needed]
|
61 |
|
62 |
## Bias, Risks, and Limitations
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
[More Information Needed]
|
67 |
-
|
68 |
-
### Recommendations
|
69 |
-
|
70 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
71 |
-
|
72 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
73 |
-
|
74 |
-
## How to Get Started with the Model
|
75 |
-
|
76 |
-
Use the code below to get started with the model.
|
77 |
-
|
78 |
-
[More Information Needed]
|
79 |
-
|
80 |
-
## Training Details
|
81 |
-
|
82 |
-
### Training Data
|
83 |
-
|
84 |
-
<!-- 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. -->
|
85 |
-
|
86 |
-
[More Information Needed]
|
87 |
-
|
88 |
-
### Training Procedure
|
89 |
-
|
90 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
91 |
-
|
92 |
-
#### Preprocessing [optional]
|
93 |
-
|
94 |
-
[More Information Needed]
|
95 |
-
|
96 |
-
|
97 |
-
#### Training Hyperparameters
|
98 |
-
|
99 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
100 |
-
|
101 |
-
#### Speeds, Sizes, Times [optional]
|
102 |
-
|
103 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
104 |
-
|
105 |
-
[More Information Needed]
|
106 |
-
|
107 |
-
## Evaluation
|
108 |
-
|
109 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
110 |
-
|
111 |
-
### Testing Data, Factors & Metrics
|
112 |
-
|
113 |
-
#### Testing Data
|
114 |
-
|
115 |
-
<!-- This should link to a Dataset Card if possible. -->
|
116 |
-
|
117 |
-
[More Information Needed]
|
118 |
-
|
119 |
-
#### Factors
|
120 |
-
|
121 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
122 |
-
|
123 |
-
[More Information Needed]
|
124 |
-
|
125 |
-
#### Metrics
|
126 |
-
|
127 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
128 |
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
### Results
|
132 |
-
|
133 |
-
[More Information Needed]
|
134 |
-
|
135 |
-
#### Summary
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
## Model Examination [optional]
|
140 |
-
|
141 |
-
<!-- Relevant interpretability work for the model goes here -->
|
142 |
-
|
143 |
-
[More Information Needed]
|
144 |
-
|
145 |
-
## Environmental Impact
|
146 |
-
|
147 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
148 |
-
|
149 |
-
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).
|
150 |
-
|
151 |
-
- **Hardware Type:** [More Information Needed]
|
152 |
-
- **Hours used:** [More Information Needed]
|
153 |
-
- **Cloud Provider:** [More Information Needed]
|
154 |
-
- **Compute Region:** [More Information Needed]
|
155 |
-
- **Carbon Emitted:** [More Information Needed]
|
156 |
-
|
157 |
-
## Technical Specifications [optional]
|
158 |
-
|
159 |
-
### Model Architecture and Objective
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
### Compute Infrastructure
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Hardware
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
#### Software
|
172 |
-
|
173 |
-
[More Information Needed]
|
174 |
|
175 |
## Citation [optional]
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
## Glossary [optional]
|
188 |
-
|
189 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## More Information [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Authors [optional]
|
198 |
-
|
199 |
-
[More Information Needed]
|
200 |
-
|
201 |
-
## Model Card Contact
|
202 |
-
|
203 |
-
[More Information Needed]
|
|
|
5 |
- msu
|
6 |
- wiki
|
7 |
- fine-tuned
|
8 |
+
datasets:
|
9 |
+
- RCC-MSU/collection3
|
10 |
+
language:
|
11 |
+
- ru
|
12 |
+
metrics:
|
13 |
+
- precision
|
14 |
+
- recall
|
15 |
+
- f1
|
16 |
+
base_model:
|
17 |
+
- Babelscape/wikineural-multilingual-ner
|
18 |
+
pipeline_tag: token-classification
|
19 |
---
|
20 |
|
21 |
# Model Card for Model ID
|
22 |
+
Fine-tuned multilingual model for russian language NER.
|
23 |
+
This is the model card for fine-tuned [Babelscape/wikineural-multilingual-ner](https://huggingface.co/Babelscape/wikineural-multilingual-ner), which has multilingual mBERT as its base.
|
24 |
+
I`ve fine-tuned it using [RCC-MSU/collection3](https://huggingface.co/datasets/RCC-MSU/collection3) dataset for token-classification task. The dataset has BIO-pattern and following labels:
|
25 |
+
```python
|
26 |
+
label_names = ['O', 'B-PER', 'I-PER', 'B-ORG', 'I-ORG', 'B-LOC', 'I-LOC']
|
27 |
+
```
|
28 |
|
29 |
|
30 |
## Model Details
|
31 |
|
32 |
+
Fine-tuning was proceeded in 3 epochs, and computed next metrics:
|
33 |
+
| Epoch | Training Loss | Validation Loss | Precision | Recall | F1 | Accuracy |
|
34 |
+
| 1 | 0.041000 | 0.032810 | 0.959569 | 0.974253 | 0.966855 | 0.993325 |
|
35 |
+
| 2 | 0.020800 | 0.028395 | 0.959569 | 0.974253 | 0.966855 | 0.993325 |
|
36 |
+
| 3 | 0.010500 | 0.029138 | 0.963239 | 0.973767 | 0.968474 | 0.993247 |
|
37 |
|
38 |
+
To avoid over-fitting due to a small amount of training samples, i used hight weight_decay = 0.1.
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
## Basic usage
|
42 |
|
43 |
+
So, you can easily use this model with pipeline for 'token-classification' task.
|
44 |
|
45 |
+
```python
|
46 |
+
import torch
|
|
|
47 |
|
48 |
+
from transformers import AutoModelForTokenClassification, AutoTokenizer, pipeline
|
49 |
+
from datasets import load_dataset
|
50 |
|
|
|
51 |
|
52 |
+
model_ckpt = "nesemenpolkov/msu-wiki-ner"
|
53 |
|
54 |
+
label_names = ['O', 'B-PER', 'I-PER', 'B-ORG', 'I-ORG', 'B-LOC', 'I-LOC']
|
55 |
|
56 |
+
id2label = {i: label for i, label in enumerate(label_names)}
|
57 |
+
label2id = {v: k for k, v in id2label.items()}
|
58 |
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
|
60 |
+
model = AutoModelForTokenClassification.from_pretrained(
|
61 |
+
model_ckpt,
|
62 |
+
id2label=id2label,
|
63 |
+
label2id=label2id,
|
64 |
+
ignore_mismatched_sizes=True
|
65 |
+
)
|
66 |
|
67 |
+
pipe = pipeline(
|
68 |
+
task="token-classification",
|
69 |
+
model=model,
|
70 |
+
tokenizer=tokenizer,
|
71 |
+
device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
|
72 |
+
aggregation_strategy="simple"
|
73 |
+
)
|
74 |
|
75 |
+
demo_sample = "Этот Иван Иванов, в паспорте Иванов И.И."
|
76 |
|
77 |
+
with torch.no_grad():
|
78 |
+
out = pipe(demo_sample)
|
79 |
+
```
|
80 |
|
|
|
|
|
|
|
81 |
|
82 |
## Bias, Risks, and Limitations
|
83 |
|
84 |
+
This model is finetuned version of [Babelscape/wikineural-multilingual-ner](https://huggingface.co/Babelscape/wikineural-multilingual-ner), on a russian language NER dataset [RCC-MSU/collection3](https://huggingface.co/datasets/RCC-MSU/collection3). It can show low scores on another language texts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
## Citation [optional]
|
88 |
+
```
|
89 |
+
@inproceedings{tedeschi-etal-2021-wikineural-combined,
|
90 |
+
title = "Fine-tuned multilingual model for russian language NER.",
|
91 |
+
author = "nesemenpolkov",
|
92 |
+
booktitle = "Detecting names in noisy and dirty data.",
|
93 |
+
month = oct,
|
94 |
+
year = "2024",
|
95 |
+
address = "Moscow, Russian Federation",
|
96 |
+
}
|
97 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|