跳转到主要内容

Facebook AI Research Sequence-to-Sequence Toolkit

项目描述



Support Ukraine MIT License Latest Release Build Status Documentation Status CicleCI Status


Fairseq(-py)是一个序列建模工具包,允许研究人员和开发人员为翻译、摘要、语言建模和其他文本生成任务训练自定义模型。

我们提供了各种序列建模论文的参考实现

实现论文列表

有什么新内容

以前更新

功能

我们还提供了翻译和语言模型的预训练模型,具有方便的 torch.hub 接口

en2de = torch.hub.load('pytorch/fairseq', 'transformer.wmt19.en-de.single_model')
en2de.translate('Hello world', beam=5)
# 'Hallo Welt'

请参阅PyTorch Hub教程,了解翻译RoBERTa的更多示例。

需求和安装

  • PyTorch版本 >= 1.5.0
  • Python版本 >= 3.6
  • 对于训练新模型,您还需要NVIDIA GPU和NCCL
  • 安装fairseq并进行本地开发
git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./

# on MacOS:
# CFLAGS="-stdlib=libc++" pip install --editable ./

# to install the latest stable release (0.10.x)
# pip install fairseq
  • 为了更快地训练,安装NVIDIA的apex
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" \
  --global-option="--deprecated_fused_adam" --global-option="--xentropy" \
  --global-option="--fast_multihead_attn" ./
  • 对于大数据集,安装PyArrowpip install pyarrow
  • 如果您使用Docker,请确保通过将--ipc=host--shm-size作为命令行选项传递给nvidia-docker run来增加共享内存大小。

入门指南

完整的文档包含了入门、训练新模型以及使用新模型类型和任务扩展fairseq的说明。

预训练模型和示例

我们为以下列出的几个任务提供了预训练模型和预处理的二进制测试集,以及示例训练和评估命令。

  • 翻译:有卷积和transformer模型可供使用
  • 语言模型:有卷积和transformer模型可供使用

我们还提供了更详细的README来重现特定论文的结果

加入fairseq社区

许可

fairseq(-py)遵循MIT许可。此许可证也适用于预训练模型。

引用

请引用如下

@inproceedings{ott2019fairseq,
  title = {fairseq: A Fast, Extensible Toolkit for Sequence Modeling},
  author = {Myle Ott and Sergey Edunov and Alexei Baevski and Angela Fan and Sam Gross and Nathan Ng and David Grangier and Michael Auli},
  booktitle = {Proceedings of NAACL-HLT 2019: Demonstrations},
  year = {2019},
}

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

fairseq-0.12.2.tar.gz (9.6 MB 查看哈希值)

上传时间:

构建分发

fairseq-0.12.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.0 MB 查看哈希值)

上传时间: CPython 3.8 manylinux: glibc 2.5+ x86-64

fairseq-0.12.2-cp38-cp38-macosx_10_9_x86_64.whl (10.4 MB 查看哈希值)

上传于 CPython 3.8 macOS 10.9+ x86-64

fairseq-0.12.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.0 MB 查看哈希值)

上传于 CPython 3.7m manylinux: glibc 2.5+ x86-64

fairseq-0.12.2-cp37-cp37m-macosx_10_9_x86_64.whl (10.4 MB 查看哈希值)

上传于 CPython 3.7m macOS 10.9+ x86-64

fairseq-0.12.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.0 MB 查看哈希值)

上传于 CPython 3.6m manylinux: glibc 2.5+ x86-64

fairseq-0.12.2-cp36-cp36m-macosx_10_9_x86_64.whl (10.4 MB 查看哈希值)

上传于 CPython 3.6m macOS 10.9+ x86-64

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面