Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LightSeq: A High Performance Library for Sequence Processing and Generation

logo

[2021/06/18] :tada: :tada: :tada: LightSeq supports fast training for models in the Transformer family now, please check out here for details.


LightSeq is a high performance training and inference library for sequence processing and generation implemented in CUDA. It enables highly efficient computation of modern NLP models such as BERT, GPT, Transformer, etc. It is therefore best useful for Machine Translation, Text Generation, Dialog, Language Modelling, Sentiment Analysis, and other related tasks with sequence data.

The library is built on top of CUDA official library(cuBLAS, Thrust, CUB) and custom kernel functions which are specially fused and optimized for Transformer model family. In addition to model components, the inference library also provide easy-to deploy model management and serving backend based on TensorRT Inference Server. With LightSeq, one can easily develop modified Transformer architecture with little additional code.

Features

>>> Training

The following is a support matrix of LightSeq training library compared with DeepSpeed.

features

>>> Inference

The following is a support matrix of LightSeq inference library compared with TurboTransformers and FasterTransformer.

support

Performance

>>> Training

Here we present the experimental results on WMT14 English to German translation task based on Transformer-big models. We train Transformer models of different sizes on eight NVIDIA Tesla V100/NVIDIA Ampere A100 GPUs with data parallel and fp16 mixed precision. Fairseq with Apex is choosed as our baseline.

We compute speedup on different batch size using the WPS (real words per second) metric.

More results is available here

>>> Inference

Here we present the experimental results on neural machine translation based on Transformer-base models using beam search methods. We choose Tensorflow and FasterTransformer as a comparison. The implementation from tensor2tensor was used as the benchmark of Tensorflow.

More results is available here.

Quick Start

Complete user guide is available here.

Fast training from Fairseq

You can experience lightning fast training by running following commands, Firstly install these requirements.

pip install lightseq fairseq sacremoses

Then you can train a translation task on wmt14 en2de dataset by running the following script

sh examples/training/fairseq/ls_fairseq_wmt14en2de.sh

To compare lightseq with fairseq, delete the arguments with ls_ prefix to using the original fairseq implementation

More usage is available here.

Fast inference from HuggingFace bart

We provide an end2end bart-base example to see how fast Lightseq is compared to HuggingFace. First you should install these requirements.

pip install torch tensorflow transformers lightseq
cd examples/inference/python

then you can check the performance by simply running following commands. hf_bart_export.py is used to transform pytorch weights to LightSeq protobuffer.

python export/hf_bart_export.py
python test/ls_bart.py

LightSeq installation from pypi only supports python 3.6 to 3.8 on Linux for now. Consider compiling from source if you have other environments.

More usage is available here.

Cite Us

If you use LightSeq in your research, please cite the following paper.

@InProceedings{wang2021lightseq,
    title = "{L}ight{S}eq: A High Performance Inference Library for Transformers",
    author = "Wang, Xiaohui and Xiong, Ying and Wei, Yang and Wang, Mingxuan and Li, Lei",
    booktitle = "Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies: Industry Papers (NAACL-HLT)",
    month = jun,
    year = "2021",
    publisher = "Association for Computational Linguistics",
    pages = "113--120",
}

Contact

Any questions or suggestions, please feel free to contact us at wangxiaohui.neo@bytedance.com, xiongying.taka@bytedance.com, qian.xian@bytedance.com, weiyang.god@bytedance.com, wangmingxuan.89@bytedance.com, lilei@cs.ucsb.edu

Metadata

Release files for lightseq 2.2.2.dev20211213

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightseq 2.2.2.dev20211213
File Size Uploaded
lightseq-2.2.2.dev20211213.tar.gz 734.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for lightseq 2.2.2.dev20211213
File
lightseq-2.2.2.dev20211213-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.12+ x86-64 Details
lightseq-2.2.2.dev20211213-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.12+ x86-64 Details
lightseq-2.2.2.dev20211213-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
lightseq-2.2.2.dev20211213-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
lightseq-2.2.2.dev20211213-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
lightseq-2.2.2.dev20211213-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details

Total release size: 261.7 MB

Release files / lightseq-2.2.2.dev20211213.tar.gz

Download URL lightseq-2.2.2.dev20211213.tar.gz
Size 734.3 kB
Tags Source
SHA-256 checksum
How to use checksums
10590727c261ce8ecf66fcd729bbdb0d33c78431b6411a442cb5a7ae99663e97
BLAKE2b-256 checksum
How to use checksums
8132c5676adad50a386fe3fd88ef0eb27497b59e452fb3a4fc71a103686a2e61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags Linux glibc 2.12+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
bcfcf14224e3b3dfb1460c3c665c6f16fbda8fe9ba373c2b7f1550e99724983c
BLAKE2b-256 checksum
How to use checksums
da209230c876bd3b418392640f526aac4c8ae85d8a9b1fcdc73ccd4b4415b58d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags CPython 3.10 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
efb1ba78327522023ef56a1b9385309a113d08fb0a7f8901da625268c2486df7
BLAKE2b-256 checksum
How to use checksums
22d8a825467e778d3299e11d2ca4cbeec88e21365a582190a67c8c2b69b763bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
0b369882a042988b2de699cd711932724c8deebf63cfa3ee6580f04d8e893bfa
BLAKE2b-256 checksum
How to use checksums
bbee93772981f89b5bb4c27a8a9d5015e73fbf3b289232e68330f74d37f0adf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
ade46fdbd75f217cc4ae429902269b92ab48ce5ea3f60f13639d62ffe99a316f
BLAKE2b-256 checksum
How to use checksums
b8c7c9d74157237323ecdffb3bc48f78ab55068ccce8bdd59e028027bf4fdfdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
19602dbdf3e62449071bcc77b32b54e64cd55f92e4fe3694c6e4ef38f5209dde
BLAKE2b-256 checksum
How to use checksums
bfcda5670b4771d93db0e8affa250970efd4d0699b8f02e1da1c4e5de74f5adc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

Release files / lightseq-2.2.2.dev20211213-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL lightseq-2.2.2.dev20211213-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 43.5 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
38fbc63dfb204d4c4a16efdddebb9cef7f68055193ccedcc55c5a9faf1803664
BLAKE2b-256 checksum
How to use checksums
be6f1c0e1d82bee66f66849da2dd7652ecbf4f76fbc3dfe0a31ac71c0aec6eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page