"vscode:/vscode.git/clone" did not exist on "d605d7d497fc99492e95c81b0bef38aaff675679"
Unverified Commit de0b10cf authored by yinghui's avatar yinghui Committed by GitHub
Browse files

fix: move dummy format loader check before quantization checks (#12532)

parent 6e29446e
...@@ -383,6 +383,10 @@ class DefaultModelLoader(BaseModelLoader): ...@@ -383,6 +383,10 @@ class DefaultModelLoader(BaseModelLoader):
allow_patterns = ["*.pt"] allow_patterns = ["*.pt"]
elif load_format == LoadFormat.NPCACHE: elif load_format == LoadFormat.NPCACHE:
allow_patterns = ["*.bin"] allow_patterns = ["*.bin"]
elif load_format == LoadFormat.DUMMY:
raise ValueError(
f"DUMMY load_format should use DummyModelLoader and not call _prepare_weights"
)
else: else:
raise ValueError(f"Unknown load_format: {load_format}") raise ValueError(f"Unknown load_format: {load_format}")
...@@ -2045,6 +2049,9 @@ def get_model_loader( ...@@ -2045,6 +2049,9 @@ def get_model_loader(
) -> BaseModelLoader: ) -> BaseModelLoader:
"""Get a model loader based on the load format.""" """Get a model loader based on the load format."""
if load_config.load_format == LoadFormat.DUMMY:
return DummyModelLoader(load_config)
if model_config and ( if model_config and (
(hasattr(model_config, "modelopt_quant") and model_config.modelopt_quant) (hasattr(model_config, "modelopt_quant") and model_config.modelopt_quant)
or model_config.quantization in ["modelopt_fp8", "modelopt_fp4", "modelopt"] or model_config.quantization in ["modelopt_fp8", "modelopt_fp4", "modelopt"]
...@@ -2071,9 +2078,6 @@ def get_model_loader( ...@@ -2071,9 +2078,6 @@ def get_model_loader(
if isinstance(load_config.load_format, type): if isinstance(load_config.load_format, type):
return load_config.load_format(load_config) return load_config.load_format(load_config)
if load_config.load_format == LoadFormat.DUMMY:
return DummyModelLoader(load_config)
if load_config.load_format == LoadFormat.SHARDED_STATE: if load_config.load_format == LoadFormat.SHARDED_STATE:
return ShardedStateLoader(load_config) return ShardedStateLoader(load_config)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment