Professor commited on
Commit
c71b3fd
·
verified ·
1 Parent(s): 919564d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -46
README.md CHANGED
@@ -1,74 +1,92 @@
 
1
  ---
2
  library_name: transformers
3
- license: afl-3.0
4
  base_model: masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0
5
  tags:
6
- - generated_from_trainer
 
 
 
 
7
  metrics:
8
  - precision
9
  - recall
10
  - f1
11
  - accuracy
12
  model-index:
13
- - name: yoruba-en-ner-model
14
- results: []
 
 
 
 
 
 
 
 
 
 
15
  ---
16
 
17
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
18
- should probably proofread and complete it, then remove this comment. -->
 
 
 
 
 
 
 
 
19
 
20
- # yoruba-en-ner-model
21
 
22
- This model is a fine-tuned version of [masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0](https://huggingface.co/masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0) on the None dataset.
23
- It achieves the following results on the evaluation set:
24
- - Loss: 0.0212
25
- - Precision: 0.9907
26
- - Recall: 0.9906
27
- - F1: 0.9907
28
- - Accuracy: 0.9956
29
 
30
- ## Model description
 
31
 
32
- More information needed
 
 
 
 
33
 
34
- ## Intended uses & limitations
 
 
 
 
35
 
36
- More information needed
 
 
37
 
38
- ## Training and evaluation data
 
 
 
 
 
 
39
 
40
- More information needed
 
41
 
42
- ## Training procedure
43
 
44
- ### Training hyperparameters
45
 
46
- The following hyperparameters were used during training:
47
- - learning_rate: 3e-05
48
- - train_batch_size: 64
49
- - eval_batch_size: 128
50
- - seed: 42
51
- - gradient_accumulation_steps: 2
52
- - total_train_batch_size: 128
53
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
54
- - lr_scheduler_type: cosine
55
- - lr_scheduler_warmup_ratio: 0.1
56
- - num_epochs: 5
57
 
58
- ### Training results
 
 
59
 
60
- | Training Loss | Epoch | Step | Validation Loss |
61
- |:-------------:|:-----:|:----:|:---------------:|
62
- | 0.1158 | 1.0 | 626 | 0.0240 |
63
- | 0.015 | 2.0 | 1252 | 0.0259 |
64
- | 0.0094 | 3.0 | 1878 | 0.0304 |
65
- | 0.0033 | 4.0 | 2504 | 0.0354 |
66
- | 0.002 | 5.0 | 3130 | 0.0377 |
67
 
 
68
 
69
- ### Framework versions
70
 
71
- - Transformers 4.57.6
72
- - Pytorch 2.9.0+cu126
73
- - Datasets 4.0.0
74
- - Tokenizers 0.22.2
 
1
+
2
  ---
3
  library_name: transformers
4
+ license: apache-2.0
5
  base_model: masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0
6
  tags:
7
+ - code-switching
8
+ - yoruba
9
+ - african-nlp
10
+ - language-identification
11
+ - lid
12
  metrics:
13
  - precision
14
  - recall
15
  - f1
16
  - accuracy
17
  model-index:
18
+ - name: yoruba-english-codeswitch-lid
19
+ results:
20
+ - task:
21
+ type: token-classification
22
+ name: Language Identification
23
+ dataset:
24
+ name: Yoruba-English Code-Switched Dataset
25
+ type: custom
26
+ metrics:
27
+ - type: f1
28
+ value: 0.9907
29
+ name: Overall F1
30
  ---
31
 
32
+ # Yoruba-English Code-Switching Language Identification (LID)
33
+
34
+ This model is a fine-tuned version of [AfroXLM-R-Large](https://huggingface.co/masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0) designed to identify language boundaries in Yoruba-English code-switched text at the token level.
35
+
36
+ ## Model Description
37
+ The model classifies each token in a sentence into one of three categories:
38
+ - **YORUBA**: Tokens belonging to the Yoruba language.
39
+ - **ENGLISH**: Tokens belonging to the English language.
40
+
41
+ By utilizing the AfroXLM-R-Large backbone, which was pre-trained with a focus on African languages, this model demonstrates exceptional robustness in handling the morphological complexities of Yoruba and the fluid transitions in code-switched speech.
42
 
 
43
 
 
 
 
 
 
 
 
44
 
45
+ ## Performance (Test Set)
46
+ The model achieved near-perfect performance. Peak generalization was reached at **Epoch 1**. While training continued for 5 epochs for observation, the final deployed weights are from the **first epoch** to ensure maximum generalizability and prevent over-memorization of training samples.
47
 
48
+ | Class | Precision | Recall | F1-Score | Support |
49
+ | :--- | :--- | :--- | :--- | :--- |
50
+ | **Overall** | **0.991** | **0.991** | **0.991** | **~80k** |
51
+ | English | 0.995 | 0.994 | 0.994 | 63,016 |
52
+ | Yoruba | 0.976 | 0.979 | 0.978 | 17,069 |
53
 
54
+ ## Intended Uses & Limitations
55
+ ### Intended Use
56
+ - Research in Code-Switching (CS) patterns.
57
+ - Preprocessing for Machine Translation or Speech Synthesis (TTS) involving Yoruba-English bilingual speakers.
58
+ - Computational linguistics studies on the matrix language frame in Nigerian English.
59
 
60
+ ### Limitations
61
+ - **Tonal Markers**: Performance may slightly vary if Yoruba text lacks standard diacritics (tonal marks).
62
+ - **Domain Sensitivity**: Optimized for general conversational and science-related prompts; performance on archaic or highly legalistic Yoruba may vary.
63
 
64
+ ## Training Procedure
65
+ ### Hyperparameters
66
+ - **Base Model**: AfroXLM-R Large (550M parameters)
67
+ - **Batch Size**: 128 (Global)
68
+ - **Learning Rate**: 3e-05 (with Cosine Decay)
69
+ - **Precision**: BF16 (Brain Floating Point)
70
+ - **Optimizer**: AdamW (Fused)
71
 
72
+ ### Training Narrative
73
+ The model converges remarkably fast due to the pre-existing linguistic knowledge in the AfroXLM-R base. Users will notice that **Validation Loss** is lowest at Epoch 1.0 ($0.0240$). Despite the training loss continuing to drop, the validation loss begins a slight upward trend thereafter, indicating that the model captures the underlying linguistic boundaries almost immediately.
74
 
 
75
 
 
76
 
77
+ ## How to Use
78
+ ```python
79
+ from transformers import pipeline
 
 
 
 
 
 
 
 
80
 
81
+ lid_model = pipeline("token-classification", model="your-username/yoruba-en-ner-model")
82
+ text = "Egungun eleru helps to cleanse the village by carrying ebo"
83
+ results = lid_model(text)
84
 
85
+ for entity in results:
86
+ print(f"Token: {entity['word']}, Language: {entity['entity']}")
 
 
 
 
 
87
 
88
+ ```
89
 
90
+ ## Citation
91
 
92
+ If you use this model in your research, please cite the Masakhane AfroXLM-R paper and this fine-tuned version.