Skip to content

Commit 3095d09

Browse files
Michael Gschwindfacebook-github-bot
authored andcommitted
(Partial) Bug fix for test_xnnpack_dq4_kv_fp32_llama (#2691)
Summary: Pull Request resolved: #2691 (Partial) Bug fix for test_xnnpack_dq4_kv_fp32_llama Also: reduce/comment out debug messages for release This fixes an ancillary bug, but does not address the xnnpack registration error 20. Reviewed By: mergennachin, JacobSzwejbka Differential Revision: D55373341 fbshipit-source-id: bcc3a9fa251e0bdb676777b4fa0f31f2035779ef
1 parent 3aefd56 commit 3095d09

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/models/llama2/quantize.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,16 @@ def convert_for_runtime(self) -> nn.Module:
147147

148148
def replace_linear_weight_only_int8_per_channel(module, node_type):
149149
for name, child in module.named_children():
150-
print(f"name: {name}")
150+
# print(f"name: {name}")
151151
if isinstance(child, nn.Linear):
152152
if (
153153
(node_type == "*")
154154
or (node_type == "output" and name == "output")
155155
or (node_type == "!output" and name != "output")
156156
):
157-
print(f"{name, child}")
158-
print(f"in_features: {child.in_features}")
159-
print(f"out_features: {child.out_features}")
157+
# print(f"{name, child}")
158+
# print(f"in_features: {child.in_features}")
159+
# print(f"out_features: {child.out_features}")
160160
setattr(
161161
module,
162162
name,
@@ -276,10 +276,10 @@ def replace_embedding_weight_only_grouped_int8_per_channel(
276276
module, bitwidth: int = 8, group_size: Optional[int] = None
277277
):
278278
for name, child in module.named_children():
279-
print(f"name: {name}")
279+
# print(f"name: {name}")
280280
if isinstance(child, nn.Embedding):
281-
print(f"{name, child}")
282-
print(f"weights size: {child.weight.size()}")
281+
# print(f"{name, child}")
282+
# print(f"weights size: {child.weight.size()}")
283283
setattr(
284284
module,
285285
name,
@@ -320,9 +320,9 @@ def create_quantized_state_dict(self) -> Dict:
320320
or isinstance(mod, fsEmbedding)
321321
or isinstance(mod, fsStandardEmbedding)
322322
):
323-
print("****")
324-
print(f"Embedding identified: {fqn, mod}")
325-
print(f"weights size: {mod.weight.size()}")
323+
# print("****")
324+
# print(f"Embedding identified: {fqn, mod}")
325+
# print(f"weights size: {mod.weight.size()}")
326326
# print(f"quantize {fqn}...")
327327

328328
print(
@@ -516,9 +516,9 @@ def create_quantized_state_dict(self):
516516
assert not mod.bias
517517
out_features = mod.out_features
518518
in_features = mod.in_features
519-
print("in features:", in_features, " out features:", out_features)
519+
# print("in features:", in_features, " out features:", out_features)
520520
# assert out_features % 8 == 0, "require out_features % 8 == 0"
521-
print(f"linear: {fqn}, in={in_features}, out={out_features}")
521+
# print(f"linear: {fqn}, in={in_features}, out={out_features}")
522522

523523
assert (
524524
in_features % self.group_size == 0

0 commit comments

Comments
 (0)