Skip to content

Commit

Permalink
fix load_empty_model
Browse files Browse the repository at this point in the history
Signed-off-by: changwangss <[email protected]>
  • Loading branch information
changwangss committed Dec 4, 2024
1 parent 8c58510 commit b4232c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions optimum/intel/neural_compressor/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,10 @@ def _weight_only_quantization(

low_cpu_mem_usage = True

if getattr(quantization_config, "use_layer_wise", False) and token is None and subfolder == "":
if getattr(quantization_config, "use_layer_wise", False):
from neural_compressor.torch import load_empty_model
model = load_empty_model(model_id, cls=model_class, trust_remote_code=trust_remote_code)

model = load_empty_model(model_id, cls=model_class, **loading_kwargs)
else:
model = model_class.from_pretrained(model_id, low_cpu_mem_usage=low_cpu_mem_usage, **loading_kwargs)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"nncf": ["nncf>=2.14.0"],
"openvino": ["nncf>=2.14.0", "openvino>=2024.5.0", "openvino-tokenizers>=2024.5.0"],
"neural-compressor": [
"neural_compressor[pt]@git+https://github.com/intel/neural-compressor.git@5c72158a6799bdf0334ef36fbd493eeed3b62d9f",
"neural_compressor[pt]@git+https://github.com/intel/neural-compressor.git@3bc8e4d0035445c51b2bd5ff6196b9b19e92b3dd",
"accelerate",
"transformers<4.46",
],
Expand Down

0 comments on commit b4232c3

Please sign in to comment.