File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ def compress(
125
125
else :
126
126
compressed_dict [name ] = value .to ("cpu" )
127
127
elif name .endswith ("zero_point" ) and torch .all (value == 0 ):
128
- # all zero_points are 0, no need to include in
129
- # compressed state_dict
128
+ continue
129
+ elif name . endswith ( "g_idx" ) and torch . any ( value <= - 1 ):
130
130
continue
131
131
else :
132
132
compressed_dict [name ] = value .to ("cpu" )
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def compress_quantized_weights(module: Module):
49
49
weight = getattr (module , "weight" , None )
50
50
scale = getattr (module , "weight_scale" , None )
51
51
zero_point = getattr (module , "weight_zero_point" , None )
52
+ g_idx = getattr (module , "weight_g_idx" , None )
52
53
53
54
if weight is None or scale is None :
54
55
# no weight, scale, or ZP, nothing to do
@@ -62,6 +63,7 @@ def compress_quantized_weights(module: Module):
62
63
x = weight ,
63
64
scale = scale ,
64
65
zero_point = zero_point ,
66
+ g_idx = g_idx ,
65
67
args = scheme .weights ,
66
68
dtype = torch .int8 ,
67
69
)
You can’t perform that action at this time.
0 commit comments