Skip to content

Commit 5a77b43

Browse files
Qualcomm AI Engine Direct - Update quant recipe for PyTorch version bump (pytorch#21237)
### Summary After the PyTorch version bump, the module path changed from layers.0.attention.wv_conv to layers.0.attention.forward.__self__.wv_conv Because of this, the existing regex r"layers\..*\.attention\.wv.*" no longer matches and the tag is missed. Updating it to r"layers\..*\.attention\..*wv.*" will cover both formats. ### Test plan LLM CI cc: @psiddh @shewu-quic @haowhsu-quic @winskuo-quic
1 parent 1f19ec6 commit 5a77b43

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎examples/qualcomm/oss_scripts/llama/static_llm_quant_recipe.py‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, verbose: bool = False):
103103
granularity=QuantGranularity.PER_CHANNEL,
104104
)
105105
.add_regex(
106-
{r"layers\..*\.attention\.wv.*"},
106+
{r"layers\..*\.attention\..*wv.*"},
107107
QuantDtype.use_8a4w,
108108
False,
109109
act_observer=MinMaxObserver,
@@ -150,7 +150,7 @@ def __init__(self, verbose: bool = False):
150150
.add_regex(
151151
{
152152
r"output\.conv",
153-
r"layers\.[0-3]\.feed_forward\.w2_conv",
153+
r"layers\.[0-3]\.feed_forward\..*w2_conv",
154154
},
155155
QuantDtype.use_16a8w,
156156
False,
@@ -189,7 +189,7 @@ def __init__(self, verbose: bool = False):
189189
.add_regex(
190190
{
191191
r"output\.conv",
192-
r"layers\.2[1-7]\.feed_forward\.w2_conv",
192+
r"layers\.2[1-7]\.feed_forward\..*w2_conv",
193193
},
194194
QuantDtype.use_16a8w,
195195
False,
@@ -249,7 +249,7 @@ def __init__(self, verbose: bool = False):
249249
)
250250
.add_regex(
251251
{
252-
r"layers\..*\.attention\.wv.*",
252+
r"layers\..*\.attention\..*wv.*",
253253
r"output\.conv",
254254
},
255255
QuantDtype.use_16a8w,
@@ -287,7 +287,7 @@ def __init__(self, verbose: bool = False):
287287
)
288288
.add_regex(
289289
{
290-
r"layers\..*\.attention\.wv.*",
290+
r"layers\..*\.attention\..*wv.*",
291291
},
292292
QuantDtype.use_16a8w,
293293
False,
@@ -324,7 +324,7 @@ def __init__(self, verbose: bool = False):
324324
)
325325
.add_regex(
326326
{
327-
r"layers\..*\.attention\.wv.*",
327+
r"layers\..*\.attention\..*wv.*",
328328
},
329329
QuantDtype.use_16a8w,
330330
False,
@@ -420,7 +420,7 @@ def __init__(self, verbose: bool = False):
420420
)
421421
.add_regex(
422422
{
423-
r"layers\..*\.attention\.wv.*",
423+
r"layers\..*\.attention\..*wv.*",
424424
},
425425
QuantDtype.use_16a8w,
426426
False,
@@ -457,9 +457,9 @@ def __init__(self, verbose: bool = False):
457457
)
458458
.add_regex(
459459
{
460-
r"layers\..*\.attention\.wv.*",
461-
r"layers\..*\.feed_forward\.w3_conv",
462-
r"layers\..*\.feed_forward\.w2_conv",
460+
r"layers\..*\.attention\..*wv.*",
461+
r"layers\..*\.feed_forward\..*w3_conv",
462+
r"layers\..*\.feed_forward\..*w2_conv",
463463
r"output\.conv",
464464
},
465465
QuantDtype.use_16a8w,
@@ -518,7 +518,7 @@ def __init__(self, verbose: bool = False):
518518
extra_kwargs={"block_size": (1, 16, 1, 1)},
519519
)
520520
.add_regex(
521-
{r"layers\..*\.attention\.wv.*"},
521+
{r"layers\..*\.attention\..*wv.*"},
522522
QuantDtype.use_8a4w,
523523
False,
524524
act_observer=MinMaxObserver,
@@ -620,7 +620,7 @@ def __init__(self, verbose: bool = False):
620620
)
621621
.add_regex(
622622
{
623-
r"layers\..*\.feed_forward\.w2_conv",
623+
r"layers\..*\.feed_forward\..*w2_conv",
624624
},
625625
QuantDtype.use_16a8w,
626626
False,
@@ -717,9 +717,9 @@ def __init__(self, verbose: bool = False):
717717
)
718718
.add_regex(
719719
{
720-
r"layers\..*\.attention\.wq.*",
721-
r"layers\..*\.attention\.wk.*",
722-
r"layers\..*\.attention\.wv.*",
720+
r"layers\..*\.attention\..*wq.*",
721+
r"layers\..*\.attention\..*wk.*",
722+
r"layers\..*\.attention\..*wv.*",
723723
},
724724
QuantDtype.use_16a8w,
725725
False,

0 commit comments

Comments
 (0)