Skip to content

Commit e0dd4d3

Browse files
authored
[Misc] Fix linter issues in examples/fp8/quantizer/quantize.py (vllm-project#3864)
1 parent e5043a3 commit e0dd4d3

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

examples/fp8/quantizer/quantize.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # noqa: E501
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -131,7 +131,8 @@ def get_tokenizer(ckpt_path, max_seq_len=MAX_SEQ_LEN, model_type=None):
131131
tokenizer.pad_token = tokenizer.eos_token
132132
if tokenizer.pad_token is None:
133133
tokenizer.pad_token = tokenizer.eos_token
134-
assert tokenizer.pad_token is not None, f"Pad token for {model_type} cannot be set!"
134+
assert (tokenizer.pad_token
135+
is not None), f"Pad token for {model_type} cannot be set!"
135136

136137
return tokenizer
137138

@@ -158,9 +159,9 @@ def get_model(ckpt_path, dtype="fp16", device="cuda"):
158159

159160
model_dtype = next(model.parameters()).dtype
160161
if dtype != model_dtype:
161-
print(
162-
f"[TensorRT-LLM][WARNING] The manually set model data type is {dtype}, "
163-
f"but the data type of the HuggingFace model is {model_dtype}.")
162+
print("[TensorRT-LLM][WARNING] The manually set model data type is "
163+
f"{dtype}, but the data type of the HuggingFace model is "
164+
f"{model_dtype}.")
164165

165166
return model
166167

@@ -244,15 +245,13 @@ def main(args):
244245
else:
245246
if "awq" in args.qformat:
246247
if args.calib_size > 32:
247-
print(
248-
f"AWQ calibration could take longer with calib_size = {args.calib_size}, Using"
249-
" calib_size=32 instead")
248+
print("AWQ calibration could take longer with calib_size = "
249+
f"{args.calib_size}, Using calib_size=32 instead")
250250
args.calib_size = 32
251-
print(
252-
"\nAWQ calibration could take longer than other calibration methods. Please"
253-
" increase the batch size to speed up the calibration process. Batch size can be"
254-
" set by adding the argument --batch_size <batch_size> to the command line.\n"
255-
)
251+
print("\nAWQ calibration could take longer than other calibration "
252+
"methods. Please increase the batch size to speed up the "
253+
"calibration process. Batch size can be set by adding the "
254+
"argument --batch_size <batch_size> to the command line.\n")
256255

257256
calib_dataloader = get_calib_dataloader(
258257
tokenizer=tokenizer,
@@ -287,9 +286,8 @@ def main(args):
287286

288287
with torch.inference_mode():
289288
if model_type is None:
290-
print(
291-
f"Unknown model type {type(model).__name__}. Continue exporting..."
292-
)
289+
print(f"Unknown model type {type(model).__name__}. Continue "
290+
"exporting...")
293291
model_type = f"unknown:{type(model).__name__}"
294292

295293
export_path = args.output_dir

0 commit comments

Comments
 (0)