Skip to content

Commit

Permalink
Update utility.py (#2079)
Browse files Browse the repository at this point in the history
  • Loading branch information
changwangss authored Dec 4, 2024
1 parent 3df2a21 commit 3bc8e4d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions neural_compressor/torch/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,8 @@ def load_empty_model(pretrained_model_name_or_path, cls=None, **kwargs):
else:
path = dowload_hf_model(pretrained_model_name_or_path)
if cls.__base__ == _BaseAutoModelClass:
config = AutoConfig.from_pretrained(path, **kwargs)
with init_empty_weights():
model = cls.from_config(config, **kwargs)
model = cls.from_pretrained(path, **kwargs)
else: # pragma: no cover
config = cls.config_class.from_pretrained(path, **kwargs)
with init_empty_weights():
Expand Down

0 comments on commit 3bc8e4d

Please sign in to comment.