Skip to content

Commit 438c35d

Browse files
committed
Make qwen3 compatible with ao-quantized checkpoints
1 parent f7c906f commit 438c35d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/models/qwen3/convert_weights.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ def qwen_3_tune_to_meta(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.
6161

6262

6363
def load_checkpoint(input_dir: str) -> Dict:
64+
# 1. Torchao-quantized checkpoint.
65+
quantized_path = os.path.join(input_dir, "pytorch_model.bin")
66+
if os.path.exists(quantized_path):
67+
sd = torch.load(quantized_path, map_location="cpu", weights_only=True)
68+
return sd
69+
70+
# 2. Official HuggingFace checkpoint.
6471
index_path = os.path.join(input_dir, "model.safetensors.index.json")
6572
if os.path.exists(index_path):
6673
# Sharded checkpoint.

0 commit comments

Comments
 (0)