laurievb commited on
Commit
d88461d
·
verified ·
1 Parent(s): fb23b85

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -3
README.md CHANGED
@@ -1,3 +1,105 @@
1
- ---
2
- license: gpl-3.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gpl-3.0
3
+ library_name: fasttext
4
+ tags:
5
+ - text-classification
6
+ - language-identification
7
+ metrics:
8
+ - f1
9
+ - precision
10
+ - recall
11
+ datasets:
12
+ - laurievb/OpenLID-v2
13
+ ---
14
+
15
+ # OpenLID-v2
16
+
17
+ - **Developed by:** Laurie Burchell, Alexandra Birch, Nikolay Bogoychev, Kenneth Heafield
18
+ - **Model type:** Text classification (language identification)
19
+ - **Language(s) (NLP):** en
20
+ - **License:** gpl-3.0
21
+ - **Resources for more information:** [OpenLID paper](https://aclanthology.org/2023.acl-short.75/) and [OpenLID v2 blog](https://laurieburchell.github.io/2024/11/12/OpenLID-v2.html)
22
+
23
+ ## Model description
24
+
25
+ OpenLID-v2 is a high-coverage, high-performance language identification model. It is an improved version of [OpenLID](https://huggingface.co/laurievb/OpenLID).
26
+
27
+ The original model and training data are described in [Burchell et al. (2023)](https://aclanthology.org/2023.acl-short.75/). The changes made to produce OpenLID-v2 and the rationale behind them are described in [this blog post](https://laurieburchell.github.io/2024/11/12/OpenLID-v2.html).
28
+
29
+
30
+ ### How to use
31
+
32
+ Here is how to use this model to detect the language of a given text. For best results, text should be cleaned and normalised with `openlid.clean_text()` prior to classification (available in this repository):
33
+
34
+ ```python
35
+ >>> import fasttext
36
+ >>> from openlid import clean_text
37
+ >>> from huggingface_hub import hf_hub_download
38
+
39
+ >>> model_path = hf_hub_download(repo_id="laurievb/OpenLID-v2", filename="model.bin")
40
+ >>> model = fasttext.load_model(model_path)
41
+ >>> input_text = clean_text("Hello, world!")
42
+ >>> model.predict(input_text)
43
+
44
+ (('__label__eng_Latn',), array([0.81148803]))
45
+
46
+ >>> model.predict("Hello, world!", k=5)
47
+
48
+ (('__label__eng_Latn', '__label__vie_Latn', '__label__nld_Latn', '__label__pol_Latn', '__label__deu_Latn'),
49
+ array([0.61224753, 0.21323682, 0.09696738, 0.01359863, 0.01319415]))
50
+ ```
51
+
52
+ ### Limitations and bias
53
+
54
+ The dataset and model only covers 189 languages. In addition, because the FLORES-200 test set consists of sentences from a single domain (wiki articles), performance on this test set may not reflect how well our classifier works in other domains.
55
+
56
+ Our work aims to broaden NLP coverage by allowing practitioners to identify relevant data in more languages. However, we note that LID is inherently a normative activity that risks excluding minority dialects, scripts, or entire microlanguages from a macrolanguage. Choosing which languages to cover may reinforce power imbalances, as only some groups gain access to NLP technologies. In addition, errors in LID can have a significant impact on downstream performance, particularly (as is often the case) when a system is used as a ‘black box’. The performance of our classifier is not equal across languages which could lead to worse downstream performance for particular groups. We mitigate this by providing metrics by class.
57
+
58
+ ## Training data
59
+
60
+ The model was trained on the [OpenLID-v2 dataset](https://huggingface.co/datasets/laurievb/OpenLID-v2).
61
+
62
+ ## Training procedure
63
+
64
+ The model was trained using fastText with the following hyperparameters set. All other hyperparameters were set to their default values.
65
+
66
+ * loss: softmax
67
+ * epochs: 2
68
+ * learning rate: 0.8
69
+ * minimum number of word occurances: 1000
70
+ * embedding dimension: 256
71
+ * character n-grams: 2-5
72
+ * word n-grams: 1
73
+ * bucket size: 1,000,000
74
+ * threads: 68
75
+
76
+
77
+ ### Evaluation datasets
78
+
79
+ The model was evaluated using the FLORES-200 benchmark provided by Costa-jussà et al. (2022) using [normalised language labels](https://huggingface.co/datasets/laurievb/OpenLID-v2/blob/main/scripts/relabel_data.py). Further information is available in the [OpenLID paper](https://aclanthology.org/2023.acl-short.75/) and [OpenLID v2 blog](https://laurieburchell.github.io/2024/11/12/OpenLID-v2.html).
80
+
81
+ ### BibTeX entry and citation info
82
+
83
+ #### ACL citation (preferred)
84
+
85
+ ```
86
+ @inproceedings{burchell-etal-2023-open,
87
+ title = "An Open Dataset and Model for Language Identification",
88
+ author = "Burchell, Laurie and
89
+ Birch, Alexandra and
90
+ Bogoychev, Nikolay and
91
+ Heafield, Kenneth",
92
+ editor = "Rogers, Anna and
93
+ Boyd-Graber, Jordan and
94
+ Okazaki, Naoaki",
95
+ booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)",
96
+ month = jul,
97
+ year = "2023",
98
+ address = "Toronto, Canada",
99
+ publisher = "Association for Computational Linguistics",
100
+ url = "https://aclanthology.org/2023.acl-short.75",
101
+ doi = "10.18653/v1/2023.acl-short.75",
102
+ pages = "865--879",
103
+ abstract = "Language identification (LID) is a fundamental step in many natural language processing pipelines. However, current LID systems are far from perfect, particularly on lower-resource languages. We present a LID model which achieves a macro-average F1 score of 0.93 and a false positive rate of 0.033{\%} across 201 languages, outperforming previous work. We achieve this by training on a curated dataset of monolingual data, which we audit manually to ensure reliability. We make both the model and the dataset available to the research community. Finally, we carry out detailed analysis into our model{'}s performance, both in comparison to existing open models and by language class.",
104
+ }
105
+ ```