Skip to content

Commit b51258a

Browse files
authored
[None][autodeploy] fix weight extraction for graph based quantized checkpoints (#9109)
Signed-off-by: Fridah-nv <[email protected]>
1 parent e96a3d2 commit b51258a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tensorrt_llm/_torch/auto_deploy/utils/node_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,15 @@ def find_get_attr_node(weight_node: Node) -> Node:
139139
n for n in node.args if isinstance(n, Node) and find_get_attr_node(n) is not None
140140
]
141141
# can be two weights (if bias weight is present)
142-
assert len(weight_nodes) >= 1, (
142+
weight_node = None
143+
if weight_nodes:
144+
weight_node = weight_nodes[0]
145+
# for modelopt quantized graph, there will be a quantize_op
146+
_, weight_params, _ = get_quantization_params_from_linear_node(node)
147+
weight_node = weight_params.input_node if weight_params else weight_node
148+
assert weight_node is not None, (
143149
"Expected exactly at least one weight node in the parametrized node"
144150
)
145-
weight_node = weight_nodes[0]
146-
# for modelopt quantized graph, there will be a quantize_op
147-
_, weight_params, _ = get_quantization_params_from_linear_node(node)
148-
weight_node = weight_params.input_node if weight_params else weight_node
149-
150151
return find_get_attr_node(weight_node)
151152

152153

0 commit comments

Comments
 (0)