Skip to main content

LightSeq is a high performance library for sequence processing and generation

Project description

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 Tesla 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.

Installation

You can install LightSeq from PyPI:

$ pip install lightseq

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:

$ PATH=/usr/local/hdf5/:$PATH ENABLE_FP32=0 ENABLE_DEBUG=0 pip install -e $PROJECT_DIR

Detailed building introduction 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/huggingface/hf_bart_export.py
$ python test/ls_bart.py

More usage is available here.

Fast deploy inference server

We provide a docker image which contains tritonserver and lightseq's dynamic link library, and you can deploy a inference server by simply replace the model file with your own model file.

$ sudo docker pull hexisyztem/tritonserver_lightseq:22.01-1

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",
}

@article{wang2021lightseq2,
  title={LightSeq2: Accelerated Training for Transformer-based Models on GPUs},
  author={Wang, Xiaohui and Xiong, Ying and Qian, Xian and Wei, Yang and Li, Lei and Wang, Mingxuan},
  journal={arXiv preprint arXiv:2110.05722},
  year={2021}
}

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

Hiring

The LightSeq team is hiring Interns/FTEs with backgrounds in deep learning system/natural language processing/computer vision/speech. We are based in Beijing and Shanghai. If you are interested, please send your resume to wangxiaohui.neo@bytedance.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightseq-3.0.0.dev20220926.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

lightseq-3.0.0.dev20220926-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

lightseq-3.0.0.dev20220926-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

lightseq-3.0.0.dev20220926-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

lightseq-3.0.0.dev20220926-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

lightseq-3.0.0.dev20220926-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

lightseq-3.0.0.dev20220926-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

File details

Details for the file lightseq-3.0.0.dev20220926.tar.gz.

File metadata

  • Download URL: lightseq-3.0.0.dev20220926.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for lightseq-3.0.0.dev20220926.tar.gz
Algorithm Hash digest
SHA256 81cd65b1ee3df7331595dfbcd6fe5f71cb8db6ec3aac56eef27e704d5f5ae016
MD5 c9a332cb6044a3f4e6d36b854f5439d6
BLAKE2b-256 7403ff122af97eb1354ab666bc0ad0fd97109e3bbe9f0dd2908ffe40574be763

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-py3-none-any.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-py3-none-any.whl
Algorithm Hash digest
SHA256 e12af60913f6fbed7fb98881c344324609a3b6719b21ca2aa39c00f1d0bf3938
MD5 9297c90b5206ab69e1ba2b0415ba2d13
BLAKE2b-256 97329b7345014d4e0682999c2f475688a56c6ef250115d072985cc1a6a6a5ebe

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdd64ebcbde173ffdc614bae9b985e3585a3603960961b1df9a395bbf24a6263
MD5 f7026a310f1be17bb91e8416bf978986
BLAKE2b-256 fea7f83440364b4306628de9b6de0f3c7b3f1fb2296d5ad1879c5427ee27f039

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa135ae98c111dcc064ddcf9c175add15d4f4c9a72ed9153ab2b8651c7a01053
MD5 ad3fb050d077ba9cdf445dbcb1e95f1d
BLAKE2b-256 db8bf0b7e4ec8f3c2fcc477f1cc4dab4fd8fdb845115a86886086a497e90e309

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4c3282b528423f2f9519a92be87b4ded1e9b2efc5eeb64abc6043ebfe2a0a7d
MD5 539336c7ad774089c101328acbdf3cac
BLAKE2b-256 3ea3e1b60a66fa5208f88da66c17e103a3f9a209e88872ac1d935567fc175d82

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c57e17aa4f861d6595d27d38d708a5d84a384edc10fbda07c2885da722d92cc
MD5 2dc4925c1f53ce92a7d738b72d0fc1b5
BLAKE2b-256 1fcb1401574ac9b3d170827ff359c9fafc33ed7badc9fe03d7299768052ae839

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0b933d4b01ccb23559d93b5c09a96c2c94a26533ec1c6150a4b9d7b6c3dd78b
MD5 35e4549b0c7fbd443c7488eb3c1c9d45
BLAKE2b-256 966238ceb54fad6c36599b6495cac97315c9925813d64499bdb1c066650db989

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf64a5b43b57cf00edca44f475f7a54369308d732431b3e20005633481b1ee0e
MD5 c300d794a756a27a4979368f7b4cb5a8
BLAKE2b-256 acafe05db6a7035f1a5633e8faf0dacdafa6896c80744233b56bfea0c04a15d1

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f268889fc1a0df346996dcc241b053bab04e2cecbb7faf97e55808be958ff2c
MD5 5d8519859ce2fad59e1cf5156348f8d7
BLAKE2b-256 ccc0007cbf0c1f4a7191e22cda04c784b3076935c7a5b6c351fd7814931f6876

See more details on using hashes here.

File details

Details for the file lightseq-3.0.0.dev20220926-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightseq-3.0.0.dev20220926-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c024496f6d33b7085c3344fc722f85f1a3f3604ebfdf42c66869576a709ba49
MD5 ae9fad1c5bafdbfbf5428bfb6003f74b
BLAKE2b-256 0b0a3375b66d6e0f55814434c57a61f27b846aa6c82be420fe108b99e4583259

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page