Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/python/py/models/builders/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,11 @@ def process_cache(input_name, name_suffix):
return flat_cos, flat_sin

def load_weights(self, input_path):
# Load the Hugging Face model
# For quantized models (e.g., Quark, AWQ, GPTQ) or GGUF, use base class logic
# which loads weights directly via QuantModel
if self.quant_type is not None or input_path.endswith(".gguf"):
return super().load_weights(input_path)

print("Loading Qwen3VLForConditionalGeneration model...")
return Qwen3VLForConditionalGeneration.from_pretrained(
self.model_name_or_path,
Expand Down
11 changes: 11 additions & 0 deletions src/python/py/models/quantized_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ def __init__(self, quant_type, input_path, quant_attrs, q_size, kv_size, interme

# Map weights to modules
for name, tensor in weights.items():
# Skip vision tower weights in VLM checkpoints
if name.startswith(("model.visual.", "model.vision.", "visual.")):
continue
# Normalize common VLM prefix so existing LLM regex + parsing keeps working
if name.startswith("model.language_model."):
name = "model." + name[len("model.language_model."):]

# Normalize Quark weight_quantizer.* naming to flat weight_* naming
name = name.replace(".weight_quantizer.scale", ".weight_scale")
name = name.replace(".weight_quantizer.zero_point", ".weight_zero_point")
Comment thread
anilmartha marked this conversation as resolved.
Outdated

# Per-layer quantization support
local_bits = self.get_layer_bits(name) # codeql[py/init-calls-subclass]
local_group_size = self.get_layer_group_size(name) # codeql[py/init-calls-subclass]
Expand Down
Loading