File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
src/llmcompressor/modeling Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def replace_modules_for_calibration(model: PreTrainedModel) -> PreTrainedModel:
29
29
30
30
31
31
def update_qwen3_moe (model , stack ):
32
- for _ , module in model .named_modules ():
32
+ for module in model .modules ():
33
33
cls_name = module .__class__ .__name__
34
34
if cls_name == "Qwen3MoeDecoderLayer" :
35
35
stack .enter_context (
@@ -38,7 +38,7 @@ def update_qwen3_moe(model, stack):
38
38
39
39
40
40
def update_deepseek3_moe (model , stack ):
41
- for _ , module in model .named_modules ():
41
+ for module in model .modules ():
42
42
cls_name = module .__class__ .__name__
43
43
if (
44
44
cls_name == "DeepseekV3DecoderLayer"
@@ -55,6 +55,8 @@ def update_deepseek3_moe(model, stack):
55
55
}
56
56
57
57
def moe_calibration_context (model : PreTrainedModel , stack ):
58
+ # Temporarily updates the MoE modules within the context
59
+ # Once the context exists, parameter updates persist
58
60
cls_name = model .__class__ .__name__
59
61
if cls_name in moe_context :
60
62
moe_context .get (cls_name )(model , stack )
Original file line number Diff line number Diff line change
1
+ # coding=utf-8
2
+ # Copyright 2025 The Qwen team, Alibaba Group and the HuggingFace Inc. team.
3
+ # All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
1
17
import torch
2
18
3
19
You can’t perform that action at this time.
0 commit comments