Skip to content

Commit cb02e2d

Browse files
yiliu30Yi4Liu
andauthored
Fix WoQ loading for Large Model (#2200)
* fix save/load Change-Id: I36d1ca10426b65abfe2093091f41906cecf2fcaf Signed-off-by: Yi Liu <yiliu4@habana.ai> * fix check Change-Id: I2cc647ed3ecc7ff499206a3d79e0f71e25605f7e Signed-off-by: Yi Liu <yiliu4@habana.ai> --------- Signed-off-by: Yi Liu <yiliu4@habana.ai> Co-authored-by: Yi Liu <yiliu4@habana.ai>
1 parent b60a3bd commit cb02e2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

neural_compressor/torch/algorithms/weight_only/save_load.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,11 @@ def _get_model_class_and_config(self):
478478

479479
has_remote_code = hasattr(config, "auto_map") and AutoModelForCausalLM.__name__ in config.auto_map
480480

481-
has_local_code = type(config) in AutoModelForCausalLM._model_mapping.keys()
481+
has_local_code = (
482+
hasattr(AutoModelForCausalLM, "_model_mapping")
483+
and type(config) in AutoModelForCausalLM._model_mapping.keys()
484+
)
485+
482486
trust_remote_code = resolve_trust_remote_code(
483487
trust_remote_code,
484488
self.model_name_or_path,
@@ -601,6 +605,7 @@ def _get_loaded_state_dict(self, config):
601605
# if hpu format tensor can be used directly, then update resolved_archive_file to the hpu format tensor file
602606
if self._use_hpu_module():
603607
resolved_archive_file = os.path.join(self._model_local_dir, HPU_SAFE_WEIGHTS_NAME)
608+
is_sharded = False
604609

605610
logger.info(f"Find weight file {resolved_archive_file}")
606611

0 commit comments

Comments
 (0)