lma_datasets
收藏资源简介:
LMA Phase 1 数据集是为两个约 25M 参数的仅解码器 Transformer 模型构建的印地语(Hindi)和尼泊尔语(Nepali)单语预训练语料库。其中印地语为资源丰富语言,尼泊尔语为资源较少语言。两种语言均使用天城文(Devanagari)书写,因此无法通过脚本区分,本数据集的核心技术挑战正是如何分离它们。数据集包含两个语料库:印地语语料库有 5,094,185 个文档,共 2.588B 字符,其中 23.1% 来自手动收集文本,最终 token 数为 655.2M;尼泊尔语语料库有 6,755,888 个文档,共 2.513B 字符,其中 22.0% 来自手动收集文本,最终 token 数为 558.9M。由于尼泊尔语手动文本比例不足 20%,对下载桶进行了下采样(保留 72.5% 的文档),以提升手动文本占比至 22.0%,而下采样通过均匀随机抽样实现,不改变文档长度分布。数据来源包括两个桶:下载桶来自公开语料库 IndicCorp v2,手动桶来自新闻站点地图、链接爬虫、MediaWiki API 和文学网站。每个文档带有 doc_id 格式 `<lang>:<bucket>:<source>:<hash>`,可追溯至来源。数据经过九阶段清洗:第一遍包括 Unicode NFC 标准化、印地语/尼泊尔语语言识别集成、外文字符修复与移除、质量过滤(长度、脚本比例、符号、数字、重复、PII 匿名化)、精确去重和 CCNet 风格学习过滤器;第二遍包括段落去重和 MinHash+LSH 近重复移除(Jaccard 0.8)。验证确保所有 14,333,273 个文档中无外文字符,且两个语料库之间无重叠(字符 n-gram 分类器准确率达 100%)。数据拆分按文档级别、按源分层,种子 1337,按字符比例 70/15/15 分配训练、验证和测试集。每个语言还额外保留一个完整来源作为未见领域测试集(印地语:bbc_hindi,尼泊尔语:nagarik_news)。拆分在 tokenizer 训练之前完成,确保 tokenizer 未见过验证或测试文本。跨拆分近重复泄露检测结果为 0。tokenized 文件由 unigram 10000 tokenizer 生成,每行存储 token 片段(而非数字 ID),包含 doc_id、bucket、source、n_tokens、text 和 tokens 字段。数据局限包括:网络爬取文本的偏见(新闻主导,正式注册多于对话),PII 使用占位符而非移除,以及清洗前尼泊尔语文档被误识别为印地语的比例远高于反向(约 120 倍)。该数据集适用于印地语和尼泊尔语的语言模型预训练、文本生成任务以及跨语言研究。
The LMA Phase 1 dataset is a monolingual pre-training corpus for Hindi and Nepali, built for two decoder-only Transformer models with approximately 25M parameters. Hindi is a high-resource language, while Nepali is a low-resource language. Both languages are written in Devanagari script, making them indistinguishable by script, and the core technical challenge of this dataset is how to separate them. The dataset consists of two corpora: the Hindi corpus contains 5,094,185 documents with 2.588B characters, 23.1% of which come from manually collected texts, resulting in 655.2M tokens; the Nepali corpus contains 6,755,888 documents with 2.513B characters, 22.0% from manually collected texts, resulting in 558.9M tokens. Since the proportion of manually collected Nepali texts was below 20%, the download bucket was downsampled (retaining 72.5% of documents) to increase the manual text proportion to 22.0%, achieved through uniform random sampling without altering document length distribution. Data sources include two buckets: the download bucket from the public corpus IndicCorp v2, and the manual bucket from news site maps, link crawlers, MediaWiki API, and literary websites. Each document has a doc_id in the format `<lang>:<bucket>:<source>:<hash>`, traceable to its source. The data underwent a nine-stage cleaning process: the first pass includes Unicode NFC normalization, integrated Hindi/Nepali language identification, foreign character repair and removal, quality filtering (length, script ratio, symbols, digits, duplicates, PII anonymization), exact deduplication, and a CCNet-style learned filter; the second pass includes paragraph deduplication and MinHash+LSH near-duplicate removal (Jaccard 0.8). Validation ensures that all 14,333,273 documents contain no foreign characters and that there is no overlap between the two corpora (character n-gram classifier achieves 100% accuracy). Data splitting is done at the document level, stratified by source, with seed 1337, allocating 70/15/15 for training, validation, and test sets by character proportion. For each language, an additional complete source is reserved as a unseen domain test set (Hindi: bbc_hindi, Nepali: nagarik_news). Splitting is done before tokenizer training to ensure the tokenizer never sees validation or test texts. Cross-split near-duplicate leakage detection results are 0. Tokenized files are generated by a unigram 10000 tokenizer, with each line storing token segments (not numeric IDs), including fields: doc_id, bucket, source, n_tokens, text, and tokens. Data limitations include: bias from web-crawled texts (news-dominant, more formal register than conversational), PII handled with placeholders instead of removal, and pre-cleaning misidentification of Nepali documents as Hindi being much higher than the reverse (about 120 times). The dataset is suitable for language model pre-training, text generation tasks, and cross-lingual research for Hindi and Nepali.
数据集概述
LMA Phase 1 是一个包含印地语(Hindi)和尼泊尔语(Nepali)两种语言的单语预训练语料库,专为一对约2500万参数的仅解码器Transformer模型构建。两种语言均使用天城文(Devanagari,U+0900-U+097F)书写,因此无法通过文字系统区分,如何分离两种语言是该数据集解决的核心技术问题。
数据规模
| 语言 | 文档数 | 字符数 | 手工文本占比(字符) | Token数 | 手工文本占比(Token) | 训练集 | 验证集 | 测试集 | 未见领域 |
|---|---|---|---|---|---|---|---|---|---|
| 印地语 | 5,094,185 | 25.88亿 | 23.1% | 6.552亿 | 24.5% | 3,564,832 | 762,609 | 763,607 | 3,137(bbc_hindi) |
| 尼泊尔语 | 6,755,888 | 25.13亿 | 22.0% | 5.589亿 | 22.0% | 4,726,832 | 1,014,710 | 1,011,740 | 2,606(nagarik_news) |
两个语料库均满足项目要求——最终token中至少20%来自手工收集的文本。
尼泊尔语降采样处理
尼泊尔语清洗后的语料包含9,031,132个下载文档,而手工文档仅207,956个,手工占比按字符计为17.0%,低于项目要求的20%。由于手工文本无法增加,因此对下载桶进行了降采样:保留6,547,932个文档(占72.5%),使手工占比提升至22.0%。
选择过程采用带种子的随机洗牌并累计字符预算,对文档均匀采样,保持长度分布不变。仅对下载桶进行处理,因其来源单一(IndicCorp v2),且不会损失语域多样性。
未删除任何数据,stage2.jsonl保持完整,选择结果存储在提交的文档ID列表中,如需重新选择只需重新生成一个文本文件。
印地语无需降采样:其23.1%的手工占比已达标。
目录结构
hindi/raw/ 收集的原始数据,未经修改 hindi/clean/ 经过九个清洗阶段后的数据 hindi/tokenized/ 每行一个文档,包含实际token片段 nepali/... 与印地语相同的三层结构
所有文件均为gzip压缩的JSONL格式,每行一个JSON对象。
注意:尼泊尔语clean/目录中的stage2.jsonl包含全部9,239,088个清洗后文档(降采样前的语料)。作为尼泊尔语语料发布的6,755,888个文档的选择由提交的ID列表定义,而非单独文件。
数据来源
两个来源桶:
- download:IndicCorp v2,公开语料库
- manual:为本项目编写的抓取和清洗代码获取的文本——包括新闻站点地图和链接爬取、MediaWiki API采集、文学网站
每个文档都带有doc_id,格式为<语言>:<桶>:<来源>:<哈希>,可追溯至来源和采集批次。
清洗流程
九个阶段,两轮处理:
- 第一轮(流式):Unicode NFC和印度字符标准化;印地语/尼泊尔语语言识别集成;外语脚本修复和移除;质量过滤(长度、脚本比例、符号、数字、重复、PII匿名化);基于内容哈希的精确去重;CCNet风格的学习过滤
- 第二轮(需全量语料):段落去重,然后MinHash+LSH近重复移除(Jaccard 0.8)
验证结果:全部14,333,273个文档中0个外来字母;五个独立层检查两种语料库间无共享内容——包括一个字符n-gram分类器,以100%准确率分离两种语言。
数据划分
- 文档级别划分,非行级别
- 按来源分层,种子1337,按字符70/15/15
- 每种语言额外保留一个完整来源作为未见领域测试集(
bbc_hindi、nagarik_news) - 划分在tokenizer训练前完成,确保tokenizer未见过验证或测试文本
- 划分后跨切分的近重复泄漏检测结果:两种语言均为零
Tokenized文件
由meet5568/lma_models中的tokenizer生成——两种语言均为10,000个unigram。每行存储token片段而非数字ID,示例格式:
json {"doc_id": "hi:manual:bbc_hindi:f79a...", "bucket": "manual", "source": "bbc_hindi", "n_tokens": 256, "text": "एशियाई खेलः पाकिस्तान ने भारत को हराया ...", "tokens": ["▁एशियाई", "▁खेल", "ः", "▁पाकिस्तान", "▁ने"]}
ID只需一次piece_to_id查找即可获得,同时存储两者每语言需额外约2GB空间。
可浏览镜像
gzip文件无法在浏览器中预览,tokenized数据也可在Kaggle上直接读取:
- https://kaggle.com/datasets/meet6868/lma-hindi-corpus
- https://kaggle.com/datasets/meet6868/lma-nepali-corpus
局限性
- 网络抓取文本带有在线发布内容的偏差:新闻占主导,正式语域占比高于对话式尼泊尔语和印地语
- PII使用占位符匿名化而非移除
- 清洗前两种语言的污染是单向的——被误识别为印地语的尼泊尔文档数量约为反向的120倍,因此语言识别阶段在廉价过滤器之前运行
许可证
该数据集使用CC-BY-4.0许可证。




