-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MODEL] Add Telechat2 (China Telecom) (#1106)
* add support for telechat2 * Update telechat2.py * Update auto.py --------- Co-authored-by: xiayongqiang <xiayq1@chinatelecom.cn> Co-authored-by: LRL-ModelCloud <165116337+LRL-ModelCloud@users.noreply.github.com> Co-authored-by: Qubitium-ModelCloud <qubitium@modelcloud.ai>
- Loading branch information
1 parent
e0ad9eb
commit 23603f6
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from ..base import BaseGPTQModel | ||
import torch | ||
|
||
|
||
class TeleChat2GPTQ(BaseGPTQModel): | ||
# telechat2 requires custom model code | ||
require_trust_remote_code = True | ||
# telechat2 requires float16 | ||
require_dtype = torch.float16 | ||
|
||
layer_type = "TelechatBlock" | ||
layers_node = "transformer.h" | ||
base_modules = ["transformer.word_embeddings", "transformer.ln_f"] | ||
|
||
""" | ||
If other frameworks are used for inference (such as VLLM), | ||
it is best not to quantify QKV due to the organization of | ||
key value weights in the Telechat model | ||
""" | ||
layer_modules = [ | ||
["self_attention.dense"], | ||
["mlp.up_proj", "mlp.gate_proj"], | ||
["mlp.down_proj"] | ||
] | ||
|
||
__all__ = ["TeleChat2GPTQ"] |