Skip to content

Commit 9592bca

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cd58360 commit 9592bca

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

neural_compressor/torch/algorithms/weight_only/save_load.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,9 @@ def _init_hf_model(self, model_class, config):
847847

848848
dtype_orig = model_class._set_default_torch_dtype(torch_dtype)
849849

850-
init_contexts = [no_init_weights(_enable=_fast_init)] if transformers.__version__ < "4.51" else\
851-
[no_init_weights()]
850+
init_contexts = (
851+
[no_init_weights(_enable=_fast_init)] if transformers.__version__ < "4.51" else [no_init_weights()]
852+
)
852853
init_contexts.append(init_empty_weights())
853854

854855
with ContextManagers(init_contexts):

neural_compressor/transformers/models/modeling_auto.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,9 @@ def load_low_bit(cls, pretrained_model_name_or_path, *model_args, **kwargs):
678678
quantization_config.weight_dtype = "int4"
679679
logger.warning("int4 weight_dtype is used, please change the config.json if you don't want to use it.")
680680

681-
init_contexts = [no_init_weights(_enable=_fast_init)] if transformers.__version__ < "4.51" else\
682-
[no_init_weights()]
681+
init_contexts = (
682+
[no_init_weights(_enable=_fast_init)] if transformers.__version__ < "4.51" else [no_init_weights()]
683+
)
683684
init_contexts.append(init_empty_weights())
684685

685686
with ContextManagers(init_contexts):

0 commit comments

Comments
 (0)