库名称: fasttext
标签:
OpenLID
- 开发者: Laurie Burchell, Alexandra Birch, Nikolay Bogoychev, Kenneth Heafield
- 模型类型: 文本分类(语言识别)
- 支持语言(NLP): 英语
- 许可协议: GPL-3.0
- 更多信息: OpenLID GitHub仓库
模型描述
OpenLID是一个高覆盖率、高性能的语言识别模型。该模型基于fastText框架,支持201种语言。训练数据及每种语言的性能指标均公开,以促进进一步研究。
模型和训练数据的详细描述见Burchell等人(2023),原始fastText实现可通过GitHub获取。
使用方法
以下示例展示如何用该模型检测文本语言:
>>> import fasttext
>>> from huggingface_hub import hf_hub_download
>>> model_path = hf_hub_download(repo_id="laurievb/OpenLID", filename="model.bin")
>>> model = fasttext.load_model(model_path)
>>> model.predict("Hello, world!")
(('__label__eng_Latn',), array([0.81148803]))
>>> model.predict("Hello, world!", k=5)
(('__label__eng_Latn', '__label__vie_Latn', '__label__nld_Latn', '__label__pol_Latn', '__label__deu_Latn'),
array([0.61224753, 0.21323682, 0.09696738, 0.01359863, 0.01319415]))
局限性及偏差
该数据集和模型仅覆盖201种语言(基于FLORES-200评估基准)。由于测试集仅包含维基百科领域的句子,在其他领域的表现可能不同。未来研究需构建更具代表性的网络数据测试集。此外,多数数据未经母语者审核,后续版本应重点增加低资源语言的母语者验证。
本工作旨在通过扩展语言识别范围促进NLP应用,但需注意:语言识别本质上是规范性活动,可能忽视少数方言、文字或微观语言。语言覆盖选择可能加剧技术获取不平等,且识别错误会对下游任务产生显著影响(尤其当系统被作为"黑盒"使用时)。模型在不同语言上表现不均,可能对特定群体造成负面影响。我们通过提供分类指标来缓解此问题。
训练数据
模型训练使用GitHub仓库公开的OpenLID数据集。
训练过程
采用fastText框架训练,关键超参数如下(其余为默认值):
- 损失函数: softmax
- 训练轮次: 2
- 学习率: 0.8
- 最小词频: 1000
- 嵌入维度: 256
- 字符n-grams: 2-5
- 词n-grams: 1
- 哈希桶大小: 1,000,000
- 线程数: 68
评估数据集
使用Costa-jussà等人(2022)提供的FLORES-200基准进行评估,详见论文。
BibTeX引用信息
ACL推荐引用
@inproceedings{burchell-etal-2023-open,
title = "An Open Dataset and Model for Language Identification",
author = "Burchell, Laurie and
Birch, Alexandra and
Bogoychev, Nikolay and
Heafield, Kenneth",
booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics",
year = "2023",
pages = "865--879",
doi = "10.18653/v1/2023.acl-short.75"
}
ArXiv引用
@article{burchell2023open,
title={An Open Dataset and Model for Language Identification},
author={Burchell, Laurie and others},
journal={arXiv preprint arXiv:2305.13820},
year={2023}
}