Skip to content

Commit 3aba051

Browse files
committed
fix: correcting whitespaces
Signed-off-by: Omobayode Fagbohungbe <omobayode.fagbohungbe@ibm.com>
1 parent 71b5aa4 commit 3aba051

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

fms_mo/dq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ def run_dq(model_args, data_args, opt_args, fms_mo_args):
198198

199199
qcfg["model"] = model_args.model_name_or_path
200200
# config layers to skip, smooth scale
201-
config_quantize_smooth_layers(qcfg)
201+
if not inference:
202+
config_quantize_smooth_layers(qcfg)
202203

203204
use_dynamo = True
204205
# use dynamo as default unless really needed, False -> fallback to TorchScript tracing

fms_mo/modules/linear.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ def forward(self, x):
281281
)
282282

283283
# pylint: disable=not-callable
284-
285284
return F.linear(x, self.W_fp, self.bias)
286285
else:
287286
qinput = self.quantize_feature(x / scale).to(x.dtype)
@@ -294,10 +293,8 @@ def forward(self, x):
294293
else:
295294
qweight = self.quantize_weight(self.weight * scale).to(
296295
self.weight.dtype
297-
)
298-
296+
)
299297
qbias = self.bias
300-
301298
# pylint: disable=not-callable
302299
output = F.linear(qinput, qweight, qbias)
303300

fms_mo/prep.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,7 @@ def make_quant_module(module, curr_full_name, qcfg, verbose=False):
392392
# For nn.Linear
393393
elif isinstance(module, nn.Linear):
394394
if module.__class__ != nn.Linear:
395-
if isinstance(
396-
module, compressed_tensors.linear.compressed_linear.CompressedLinear
397-
):
395+
if isinstance(module, compressed_tensors.linear.compressed_linear.CompressedLinear):
398396
pass
399397
else:
400398
logger.warning(

fms_mo/utils/dq_inf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def save_vllm_fp8(model: nn.Module, qcfg: dict, tokenizer=None, folder: str = No
102102
)
103103
tokenizer.save_pretrained(folder)
104104

105-
with open(folder + "/config.json", "w+", encoding='utf-8') as f:
105+
with open(folder + "/config.json", "w+", encoding="utf-8") as f:
106106
json.dump(config, f, indent=4)
107107

108108

@@ -133,7 +133,7 @@ def convert_fms_mo_to_vllm_fp8_format(checkpoint: str = None, folder: str = None
133133
save_torch_state_dict(
134134
fms_dict, folder, filename_pattern="fms_mo{suffix}.safetensors"
135135
)
136-
with open(folder + "/config.json", "w+", encoding='utf-8') as f:
136+
with open(folder + "/config.json", "w+", encoding="utf-8") as f:
137137
json.dump(config, f, indent=4)
138138

139139

0 commit comments

Comments
 (0)