Downloads · 30 days
0
TMElyralab/lyraBaichuan
lyraBaichuan is a machine learning model from TMElyralab. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
We have released 7 lyraBaichuan models including lyraBaichuan-7B, lyraBaichuan-13B-Base, lyraBaichuan-13B-Chat, lyraBaichuan2-7B-Base, lyraBaichuan2-7B-Chat, lyraBaichuan2-13B-Base and lyraBaichuan2-13B-Chat.
Downloads · 30 days
0
Access
Public
Updated Sep 13, 2023
Repo size
153 GB
Likes
4
Public
Click a slice to open those files.
.bin153 GB · 99%
From the Hugging Face model README
We have released 7 lyraBaichuan models including lyraBaichuan-7B, lyraBaichuan-13B-Base, lyraBaichuan-13B-Chat, lyraBaichuan2-7B-Base, lyraBaichuan2-7B-Chat, lyraBaichuan2-13B-Base and lyraBaichuan2-13B-Chat.
These highly optimized Baichuan models are suitable for Ampere (A100/A10) as well as Volta (V100).
If you like our work and consider to join us, feel free to drop a line at [email protected].
lyraBaichuan is currently the fastest Baichuan models (Baichuan-7B, Baichuan-13B, Baichuan2-7B, Baichuan2-13B) available. The inference speed of lyraBaichuan has achieved up to 4300+ tokens/s on A100, up to 2.4x acceleration upon the torch version.
Among its main features are:
We use the Baichuan2-7B-Base and Baichuan2-13B-Base model for measurement, but this optimized inference is also applicable to other Baichuan models, including Baichuan-7B and Baichuan-13B.
| Version | Batch Size 1 | Batch Size 8 | Batch Size 16 | Batch Size 32 | Batch Size 64 |
|---|---|---|---|---|---|
| Torch 2.0.1 | 41.2 | 323.2 | 640.0 | 1256.8 | 2231.0 |
| lyraBaichuan | 125.9 | 948.1 | 1749.3 | 2974.0 | 4370.1 |
| Version | Batch Size 1 | Batch Size 8 | Batch Size 16 | Batch Size 32 | Batch Size 64 |
|---|---|---|---|---|---|
| Torch 2.0.1 | 40.9 | 307.9 | 555.6 | 1010.4 | 1601.0 |
| lyraBaichuan | 80.0 | 568.2 | 1124.4 | 1942.6 | 2828.0 |
nvcr.io/nvidia/pytorch:22.12-py3nvcr.io/nvidia/pytorch:23.02-py3docker pull nvcr.io/nvidia/pytorch:23.02-py3
docker run --rm -it --gpus all -v ./:/lyraBaichuan nvcr.io/nvidia/pytorch:23.02-py3
pip install -r requirements.txt
python demo.py
from lyra_baichuan import lyraBaichuan7B, lyraBaichuan13B
model_path = "./models/Baichuan2-13B-lyra"
tokenizer_path = "./models/Baichuan2-13B-lyra"
inference_dtype = 'fp16'
prompt = "登鹳雀楼->王之涣\n夜雨寄北->"
memopt_mode = 1
max_output_length = 64
arch = "Ampere" # Ampere or Volta
cuda_version = 12 # cuda version, we currently support 11 and 12
# To use 7B model, initialize with lyraBaichuan7B
model = lyraBaichuan13B(model_path,
tokenizer_path = tokenizer_path,
dtype = inference_dtype,
memopt_mode = memopt_mode,
arch = arch,
cuda_version = cuda_version)
bs = 1
prompts = [prompt, ] * bs
output_texts = model.generate(
prompts, output_length=max_output_length,
top_k=30, top_p=0.85, temperature=1.0, repetition_penalty=1.0, do_sample=False)
print(output_texts)
#### input
登鹳雀楼->王之涣
夜雨寄北->
#### output
李商隐
望洞庭->刘禹锡
黄鹤楼送孟浩然之广陵->李白
登岳阳楼->杜甫
秋词->刘禹锡
枫桥夜泊->张继
饮湖上初晴后雨->苏轼
浪淘沙->刘禹锡
@Misc{lyraBaichuan2023,
author = {Haoxiong Su, Kangjian Wu, Zhengtao Wang, Yibo Lu, Bin Wu},
title = {lyraBaichuan: Accelerating Baichuan models to 4300+ tokens/s},
howpublished = {\url{https://huggingface.co/TMElyralab/lyraBaichuan}},
year = {2023}
}
[bug] mark in the title.