Facebook 10 月 19 日开源了 M2M-100 模型的源代码,并称该算法是第一个能够在不依赖英语数据的情况下,在 100 种语言之间进行翻译的算法。也就是这说,无需通过英文做中介,该模型就可对这 100 种语言直接互译。

M2M-100 基于 Facebook 的多语言模型 XLM-R,使用 ccAligned,ccMatrix 和 LASER 等开源数据挖掘工具收集了包含 100 多种语言的超过 75 亿个句子,根据语言分类、地理和文化相似性等参数分为 14 种不同的语言组。在 14 个语言组中,每个语言会被标识一到三种“过渡语言”,然后将其作为翻译成不同语言组的基础。

生成数据

在应用 SPM 进行数据预处理之前,需要标记所有数据集。如果使用这些评估数据集,请引用其相关论文。

# WMT - use sacrebleu, example here:
sacrebleu -t wmt14 -l fr-en --echo src > wmt.test.fr-en.fr
sacrebleu -t wmt14 -l fr-en --echo ref > wmt.test.fr-en.en# WAT
wget http://lotus.kuee.kyoto-u.ac.jp/WAT/my-en-data/wat2019.my-en.zip
unzip wat2019.my-en.zip# FLORES
# download from: https://github.com/facebookresearch/flores# TED - need to detokenize with Moses!
# from: https://github.com/neulab/word-embeddings-for-nmt
wget http://phontron.com/data/ted_talks.tar.gz# Autshumato
# request to download: https://repo.sadilar.org/handle/20.500.12185/397# Tatoeba Challenge
# available here: https://github.com/Helsinki-NLP/Tatoeba-Challenge

训练数据

为了产生训练数据,结合使用 CCMatrix 和 CCAligned。查看此处的说明下载原始数据。

数据预处理

下载原始数据后,需要对数据进行处理,然后应用 SPM,然后进行二值化。

# preprocess data# remove sentences with more than 50% punctuation
python /path/to/fairseq/examples/m2m_100/process_data/remove_too_much_punc.py # deduplicate training data
paste /path/to/datadir/train.$src /path/to/datadir/train.$tgt | awk '!x[$0]++' > /path/to/datadir/train.dedup
echo "keeping $(wc -l /path/to/datadir/train.dedup) bitext out of $(wc -l /path/to/datadir/train.$src)"
cut -f1 /path/to/datadir/train.dedup > /path/to/datadir/train.$src
cut -f2 /path/to/datadir/train.dedup > /path/to/datadir/train.$tgt# remove all instances of evaluation data from the training data
python /path/to/fairseq/examples/m2m_100/process_data/dedup_data.py # frequency cleaning
wget https://dl.fbaipublicfiles.com/m2m_100/histograms.tar.gz
tar -xvzf histograms.tar.gz
python /path/to/fairseq/examples/m2m_100/process_data/clean_histogram.py --src $src --tgt $tgt --src-file /path/to/source/file --tgt-file /path/to/output/file --src-output-file source_output.$src --tgt-output-file target_output.$tgt --histograms /path/to/histograms# apply SPM
wget https://dl.fbaipublicfiles.com/m2m_100/spm.128k.model
python /path/to/fairseq/scripts/spm_encode.py \--model spm.128k.model \--output_format=piece \--inputs=/path/to/input/file/here \--outputs=/path/to/output/file/here# length ratio cleaning
perl mosesdecoder/scripts/training/clean-corpus-n.perl --ratio 3 /path/to/training/data/train.spm.$src-$tgt $src $tgt /path/to/output/directory/train.spm.$src-$tgt 1 250# binarize data
wget https://dl.fbaipublicfiles.com/m2m_100/data_dict.128k.txt
fairseq-preprocess \--source-lang $src --target-lang $tgt \--testpref spm.$src.$tgt \--thresholdsrc 0 --thresholdtgt 0 \--destdir data_bin \--srcdict data_dict.128k.txt --tgtdict data_dict.128k.txt

训练脚本

为了重现模型训练,使用 fairseq-py 的多语言翻译任务进行训练。

生成

从该模型中生成,需遵循以下生成部分中的命令。

@article{fan2020beyond,title={Beyond English-Centric Multilingual Machine Translation},author={Fan, Angela and Bhosale, Shruti and Schwenk, Holger and Ma, Zhiyi and El-Kishky, Ahmed and Goyal, Siddharth and Baines, Mandeep and Celebi, Onur and Wenzek, Guillaume and Chaudhary, Vishrav and Goyal, Naman and Birch, Tom and Liptchinsky, Vitaliy and Edunov, Sergey and Grave, Edouard and Auli, Michael and Joulin, Armand},journal={arXiv preprint},year={2020}
}@article{schwenk2019ccmatrix,title={Ccmatrix: Mining billions of high-quality parallel sentences on the web},author={Schwenk, Holger and Wenzek, Guillaume and Edunov, Sergey and Grave, Edouard and Joulin, Armand},journal={arXiv preprint arXiv:1911.04944},year={2019}
}@article{el2019massive,title={A Massive Collection of Cross-Lingual Web-Document Pairs},author={El-Kishky, Ahmed and Chaudhary, Vishrav and Guzman, Francisco and Koehn, Philipp},journal={arXiv preprint arXiv:1911.06154},year={2019}
}

参考链接:

https://venturebeat.com/2020/10/19/facebooks-open-source-m2m-100-model-can-translate-between-100-different-languages/

https://siliconangle.com/2020/10/19/facebook-ai-open-sources-m2m-100-multilingual-model-improve-translation-accuracy/

Facebook 开源 M2M-100,不依赖英语互译百种语言相关推荐

  1. Facebook 开源增强版 LASER 库:可实现 93 种语言的零样本迁移...

    雷锋网 AI 科技评论按:去年 12 月份,Facebook 在论文中提出了一种可学习 93 种语言的联合多语言句子表示的架构,该架构仅使用一个编码器,就可以在不做任何修改的情况下实现跨语言迁移,为自 ...

  2. Facebook 开源增强版 LASER 库:可实现 93 种语言的零样本迁移

    雷锋网 AI 科技评论按:去年 12 月份,Facebook 在论文中提出了一种可学习 93 种语言的联合多语言句子表示的架构,该架构仅使用一个编码器,就可以在不做任何修改的情况下实现跨语言迁移,为自 ...

  3. Python 小工具:调用「百度翻译API」实现英汉互译及多语言翻译

    Python 小工具:调用「百度翻译 API」实现英汉互译及多语言翻译 API 简介 过程详解 完整代码 结果展示 附:官方 Demo - Python 2 版本 Python 小工具:调用「百度翻译 ...

  4. Facebook增强版LASER开源:零样本迁移学习,支持93种语言

    来源| Facebook AI 研究院 译者 | Linstancy 责编 | 琥珀 出品 | AI 科技大本营(ID:rgznai100) [导语]为了加速自然语言处理 (NLP) 在更多语言上实现 ...

  5. 不以英语为中心,百种语言互译,FB开源首个单一多语言MT模型

    机器之心报道 机器之心编辑部 Facebook AI 近日开源了多语言机器翻译模型 M2M-100,该模型不依赖以英语为中心的数据,可以实现 100 种语言之间的相互翻译. 机器翻译(MT)打破了人类 ...

  6. 经典30句---四川话英语互译

    成都牛人英语"翻译家",川英互译,大家娱乐哈. 1.Are you kidding me?你豁老子哦? 2.Dude.哥佬倌 3.Long time no see.死哪儿切了喃?那 ...

  7. 世界最大的多语言语音数据集现已开源!超40万小时,共23种语言

    点击上方"视学算法",选择加"星标"或"置顶" 重磅干货,第一时间送达 博雯 发自 凹非寺 量子位 报道 | 公众号 QbitAI 最近,F ...

  8. Manning大神牵头,斯坦福开源Python版NLP库Stanza:涵盖66种语言

    点击上方"AI遇见机器学习",选择"星标"公众号 重磅干货,第一时间送达 转自:机器之心 对于斯坦福 NLP 库,我们一定不会陌生,但是这一库主要基于 Java ...

  9. 【重磅来袭】斯坦福开源Python版NLP库Stanza:涵盖66种语言!

    关注上方"深度学习技术前沿",选择"星标公众号", 资源干货,第一时间送达! 对于斯坦福 NLP 库,我们一定不会陌生,但是这一库主要基于 Java.近日,Ch ...

最新文章

  1. 【数学专题】约数个数与欧拉函数
  2. linux一键重装系统脚本,一键重装CentOS纯净版系统shell脚本
  3. @staticmethod用法
  4. c php乱码,php分割GBK中文乱码的解决方法
  5. SpringBoot 之Spring Boot Starter依赖包及作用
  6. 下班搜包被诉 苹果支付近3000万美元与加州门店员工和解
  7. 一篇总结得超全的前端进阶文章!入门、技巧、方法、书籍、网站...一步到位!
  8. python 实现SOM: 函数更新
  9. 一键杀死最近打开APP
  10. java 解压文件夹_java新人,在学习解压缩文件时,解压文件后,里面的文件变文件夹...
  11. 沟通的重要工具——乔哈里视窗
  12. FPGA实现数字QAM调制系统
  13. 网站CDN加速是什么? 看完这篇你就明白了!
  14. 题目:P3717 [AHOI2017初中组]cover
  15. windows替换鼠标指针
  16. 青轩桃李能几何,流光欺人忽蹉跎。 poll
  17. 同余问题及线性同余方程(组)
  18. 团队管理2 | 管理的天时、地利、人和
  19. C++中BitBlt的使用方法详解
  20. FFmpeg av_dump_format输出的tbn、tbc、tbr、PAR、DAR的含义

热门文章

  1. netty cpu 占用率 高_交换机CPU使用率高问题定位
  2. 帮设计师打开思路的网站主页设计案例,给你出灵感
  3. 手机壁纸 NBA群星高清壁纸
  4. 呼叫 :邓伦粉丝!手机桌面壁纸来喽
  5. 设计灵感|大火C4D立体字效在海报中的应用
  6. python 切片_零基础学python_11_列表(切片+遍历切片+复制)
  7. C++11 thread使用
  8. Spring 框架 AOP 的总结
  9. 从Fedora CoreOS(Fedora35)到CentOS-Stream9的重构
  10. virtio-fs: A Shared File System for Virtual Machines