Skip to content

Commit e8bc5dd

Browse files
willmjfabianlim
andauthored
model: Add granite GPTQ model (#95)
* feat: Add granite GPTQ model Signed-off-by: Will Johnson <[email protected]> * fmt + lint Signed-off-by: Yu Chin Fabian Lim <[email protected]> * update granite benches to be in line with #92 Signed-off-by: Yu Chin Fabian Lim <[email protected]> --------- Signed-off-by: Will Johnson <[email protected]> Signed-off-by: Yu Chin Fabian Lim <[email protected]> Co-authored-by: Yu Chin Fabian Lim <[email protected]>
1 parent 28eb168 commit e8bc5dd

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

plugins/accelerated-peft/src/fms_acceleration_peft/gptqmodel/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .gemma import GemmaGPTQ
2222
from .gpt_bigcode import GPTBigCodeGPTQ
2323
from .gpt_neox import GPTNeoXGPTQ
24+
from .granite import GraniteGPTQ
2425
from .llama import LlamaGPTQ
2526
from .mistral import MistralGPTQ
2627
from .mixtral import MixtralGPTQ

plugins/accelerated-peft/src/fms_acceleration_peft/gptqmodel/models/_const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"llama",
2626
"mistral",
2727
"mixtral",
28+
"granite",
2829
"gemma",
2930
"dbrx_converted",
3031
]

plugins/accelerated-peft/src/fms_acceleration_peft/gptqmodel/models/auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from .gemma import GemmaGPTQ
2929
from .gpt_bigcode import GPTBigCodeGPTQ
3030
from .gpt_neox import GPTNeoXGPTQ
31+
from .granite import GraniteGPTQ
3132
from .llama import LlamaGPTQ
3233
from .mistral import MistralGPTQ
3334
from .mixtral import MixtralGPTQ
@@ -39,6 +40,7 @@
3940
"mistral": MistralGPTQ,
4041
"mixtral": MixtralGPTQ,
4142
"gemma": GemmaGPTQ,
43+
"granite": GraniteGPTQ,
4244
"dbrx": DbrxGPTQ,
4345
"dbrx_converted": DbrxConvertedGPTQ,
4446
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
###############################################################################
2+
# Adapted from https://github.com/ModelCloud/GPTQModel
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
###############################################################################
16+
# Local
17+
from .base import BaseGPTQModel
18+
19+
20+
class GraniteGPTQ(BaseGPTQModel):
21+
base_modules = ["model.embed_tokens", "model.norm"]
22+
23+
layers_node = "model.layers"
24+
layer_type = "GraniteDecoderLayer"
25+
layer_modules = [
26+
["self_attn.k_proj", "self_attn.v_proj", "self_attn.q_proj"],
27+
["self_attn.o_proj"],
28+
["mlp.up_proj", "mlp.gate_proj"],
29+
["mlp.down_proj"],
30+
]

scripts/benchmarks/scenarios-granite.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ scenarios:
4545
model_name_or_path:
4646
- 'ibm/PowerLM-3b'
4747
torch_dtype: bfloat16
48-
bf16: True
4948

5049
- name: standard-peft
5150
framework_config:
5251
-
5352
- foak-fast-kernels
5453
arguments:
55-
bf16: True
5654
learning_rate: 2e-4
5755
torch_dtype: bfloat16
5856
peft_method: lora

0 commit comments

Comments
 (0)