Update README.md
Browse filesadd info to Model card
README.md
CHANGED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
base_model:
|
5 |
+
- google-bert/bert-large-uncased
|
6 |
+
pipeline_tag: token-classification
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
# Model Card for Mountain NER Model
|
12 |
+
|
13 |
+
**Model Summary**
|
14 |
+
|
15 |
+
This model is a fine-tuned Named Entity Recognition (NER) model specifically designed to identify mountain names in text. It is trained to detect and classify mountain entities using labeled data and state-of-the-art NER architectures. The model can handle both single-word and multi-word mountain names (e.g., "Kilimanjaro" or "Rocky Mountains").
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
## Intended Use
|
21 |
+
|
22 |
+
- **Task**: Named Entity Recognition (NER) for mountain name identification.
|
23 |
+
- Input: A text string containing sentences or paragraphs.
|
24 |
+
- Output: A list of tokens annotated with labels:
|
25 |
+
|
26 |
+
- B-MOUNTAIN: Beginning of a mountain name.
|
27 |
+
- I-MOUNTAIN: Inside a mountain name.
|
28 |
+
- O: Outside of any mountain entity.
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
## How to Use
|
35 |
+
|
36 |
+
You can load this model using the Hugging Face `transformers` library:
|
37 |
+
|
38 |
+
```python
|
39 |
+
from transformers import BertTokenizer, BertForTokenClassification
|
40 |
+
import torch
|
41 |
+
|
42 |
+
tokenizer = BertTokenizer.from_pretrained("your_username/your_model")
|
43 |
+
model = BertForTokenClassification.from_pretrained("your_username/your_model")
|
44 |
+
|
45 |
+
text = "The Kilimanjaro is one of the most famous mountains."
|
46 |
+
|
47 |
+
inputs = tokenizer(text, return_tensors="pt")
|
48 |
+
with torch.no_grad():
|
49 |
+
outputs = model(**inputs)
|
50 |
+
|
51 |
+
predictions = torch.argmax(outputs.logits, dim=-1)
|
52 |
+
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"].squeeze())
|
53 |
+
labels = [model.config.id2label[label] for label in predictions.squeeze().tolist()]
|
54 |
+
|
55 |
+
print(list(zip(tokens, labels)))
|
56 |
+
```
|
57 |
+
|
58 |
+
|
59 |
+
## Dataset
|
60 |
+
|
61 |
+
The dataset includes annotated examples of text with mountain names in BIO format:
|
62 |
+
|
63 |
+
- **Training Set**: 350 examples
|
64 |
+
- **Validation Set**: 75 examples
|
65 |
+
- **Test Set**: 75 examples
|
66 |
+
|
67 |
+
The dataset was created by combining known mountain names with sentences containing them.
|
68 |
+
|
69 |
+
|
70 |
+
## Limitations
|
71 |
+
|
72 |
+
- The model is specifically designed for mountain names and may not generalize to other named entities.
|
73 |
+
- Performance may degrade on noisy or informal text.
|
74 |
+
- Multi-word mountain names must be tokenized correctly for proper recognition.
|
75 |
+
|
76 |
+
- **Repository:** [https://github.com/Yevheniia-Ilchenko/Bert_NER]
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
## Training Details
|
81 |
+
|
82 |
+
The model was fine-tuned using the **BERT Base Uncased** architecture for token classification. Below are the training details:
|
83 |
+
|
84 |
+
- **Model Architecture**: BERT for Token Classification (`bert-base-uncased`).
|
85 |
+
- **Dataset**: Custom-labeled dataset in BIO format for mountain name recognition.
|
86 |
+
- **Hyperparameters**:
|
87 |
+
- **Learning Rate**: `2e-4`
|
88 |
+
- **Batch Size**: `16`
|
89 |
+
- **Maximum Sequence Length**: `128`
|
90 |
+
- **Number of Epochs**: `3`
|
91 |
+
- **Optimizer**: AdamW
|
92 |
+
- **Warmup Steps**: `500`
|
93 |
+
- **Weight Decay**: `0.01`
|
94 |
+
- **Evaluation Strategy**: Steps-based evaluation with automatic saving of the best model.
|
95 |
+
- **Training Arguments**:
|
96 |
+
- `save_total_limit=3`: Limits the number of saved checkpoints.
|
97 |
+
- `load_best_model_at_end=True`: Ensures the best model is used after training.
|
98 |
+
- **Training Performance**:
|
99 |
+
- **Training Runtime**: `570.44 seconds`
|
100 |
+
- **Training Samples per Second**: `1.841`
|
101 |
+
- **Training Steps per Second**: `0.116`
|
102 |
+
- **Final Training Loss**: `0.4017`
|
103 |
+
- **Evaluation Metrics**:
|
104 |
+
- **Evaluation Loss**: `0.0839`
|
105 |
+
- **Precision**: `97.11%`
|
106 |
+
- **Recall**: `96.89%`
|
107 |
+
- **F1 Score**: `96.91%`
|
108 |
+
- **Evaluation Runtime**: `13.76 seconds`
|
109 |
+
- **Samples per Second**: `5.449`
|
110 |
+
- **Steps per Second**: `0.726`
|