Skip to content

Commit 611a5a8

Browse files
authored
[inference] Add smmoothquant for llama (#4904)
* [inference] add int8 rotary embedding kernel for smoothquant (#4843) * [inference] add smoothquant llama attention (#4850) * add smoothquant llama attention * remove uselss code * remove useless code * fix import error * rename file name * [inference] add silu linear fusion for smoothquant llama mlp (#4853) * add silu linear * update skip condition * catch smoothquant cuda lib exception * prcocess exception for tests * [inference] add llama mlp for smoothquant (#4854) * add llama mlp for smoothquant * fix down out scale * remove duplicate lines * add llama mlp check * delete useless code * [inference] add smoothquant llama (#4861) * add smoothquant llama * fix attention accuracy * fix accuracy * add kv cache and save pretrained * refactor example * delete smooth * refactor code * [inference] add smooth function and delete useless code for smoothquant (#4895) * add smooth function and delete useless code * update datasets * remove duplicate import * delete useless file * refactor codes (#4902) * rafactor code * add license * add torch-int and smoothquant license
1 parent a0684e7 commit 611a5a8

File tree

18 files changed

+2962
-0
lines changed

18 files changed

+2962
-0
lines changed

LICENSE

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,53 @@ Copyright 2021- HPC-AI Technology Inc. All rights reserved.
477477
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
478478
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
479479
SOFTWARE.
480+
481+
482+
---------------- LICENSE FOR torch-int ----------------
483+
484+
MIT License
485+
486+
Copyright (c) 2022 Guangxuan Xiao
487+
488+
Permission is hereby granted, free of charge, to any person obtaining a copy
489+
of this software and associated documentation files (the "Software"), to deal
490+
in the Software without restriction, including without limitation the rights
491+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
492+
copies of the Software, and to permit persons to whom the Software is
493+
furnished to do so, subject to the following conditions:
494+
495+
The above copyright notice and this permission notice shall be included in all
496+
copies or substantial portions of the Software.
497+
498+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
499+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
500+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
501+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
502+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
503+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
504+
SOFTWARE.
505+
506+
507+
---------------- LICENSE FOR smoothquant ----------------
508+
509+
MIT License
510+
511+
Copyright (c) 2022 MIT HAN Lab
512+
513+
Permission is hereby granted, free of charge, to any person obtaining a copy
514+
of this software and associated documentation files (the "Software"), to deal
515+
in the Software without restriction, including without limitation the rights
516+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
517+
copies of the Software, and to permit persons to whom the Software is
518+
furnished to do so, subject to the following conditions:
519+
520+
The above copyright notice and this permission notice shall be included in all
521+
copies or substantial portions of the Software.
522+
523+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
524+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
525+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
526+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
527+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
528+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
529+
SOFTWARE.

colossalai/inference/quant/smoothquant/__init__.py

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try:
2+
import torch_int
3+
4+
HAS_TORCH_INT = True
5+
except ImportError:
6+
HAS_TORCH_INT = False
7+
raise ImportError(
8+
"Not install torch_int. Please install torch_int from https://github.com/Guangxuan-Xiao/torch-int"
9+
)
10+
11+
if HAS_TORCH_INT:
12+
from .llama import LLamaSmoothquantAttention, LlamaSmoothquantMLP

0 commit comments

Comments
 (0)