Skip to content

Commit 536b985

Browse files
authored
Arm backend: Refine DeepSeek-Qwen model tests (pytorch#21733)
Refine the DeepSeek-R1-Distill-Qwen-1.5B model tests to follow the final layer-test split more closely. The reduced-config model cases remain the normal CI coverage, while the checkpoint-sized 1.5B BF16 paths stay isolated in slow xlarge tests. This keeps the large embedding table and checkpoint-sized activations out of the normal shard. The patch also removes the defensive qwen2 importorskip guard so the test depends on the normal CI environment in the same way as the layer tests. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani
1 parent 41b7a76 commit 536b985

3 files changed

Lines changed: 356 additions & 18 deletions

File tree

‎backends/arm/test/models/DeepSeek_R1_Distill_Qwen/test_deepseek_r1_distill_qwen_layers.py‎

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from executorch.backends.arm.test.models.DeepSeek_R1_Distill_Qwen.deepseek_r1_distill_qwen_test_config import (
1616
get_deepseek_r1_distill_qwen_1_5b_checkpoint_config,
1717
)
18+
from executorch.backends.arm.test.models.model_test_utils import to_bfloat16
1819
from executorch.backends.arm.test.ops.mxfp.common import MXFPTosaPipelineFP
1920
from executorch.backends.arm.test.tester.test_pipeline import (
2021
TosaPipelineFP,
@@ -74,19 +75,6 @@ def prepare_model_and_inputs(cls):
7475
raise NotImplementedError
7576

7677

77-
def _to_bfloat16(
78-
model: torch.nn.Module, inputs: input_t
79-
) -> tuple[torch.nn.Module, input_t]:
80-
return model.to(torch.bfloat16), tuple(
81-
(
82-
x.to(torch.bfloat16)
83-
if isinstance(x, torch.Tensor) and x.is_floating_point()
84-
else x
85-
)
86-
for x in inputs
87-
)
88-
89-
9078
def _is_linear(module: torch.nn.Module, _fqn: str) -> bool:
9179
return isinstance(module, torch.nn.Linear)
9280

@@ -422,7 +410,7 @@ def test_deepseek_r1_distill_qwen_tosa_FP_bf16_xlarge(
422410
test_case: DeepSeekR1DistillQwenTestCase,
423411
):
424412
model, inputs = test_case.model_cls.prepare_model_and_inputs()
425-
model, inputs = _to_bfloat16(model, inputs)
413+
model, inputs = to_bfloat16(model, inputs)
426414
with torch.no_grad():
427415
pipeline = TosaPipelineFP[input_t](
428416
model,
@@ -445,7 +433,7 @@ def test_deepseek_r1_distill_qwen_tosa_FP_bf16(
445433
test_case: DeepSeekR1DistillQwenTestCase,
446434
):
447435
model, inputs = test_case.model_cls.prepare_model_and_inputs()
448-
model, inputs = _to_bfloat16(model, inputs)
436+
model, inputs = to_bfloat16(model, inputs)
449437
with torch.no_grad():
450438
pipeline = TosaPipelineFP[input_t](
451439
model,
@@ -496,7 +484,7 @@ def test_deepseek_r1_distill_qwen_tosa_mxfp8_bf16(
496484
test_case: DeepSeekR1DistillQwenTestCase,
497485
):
498486
model, inputs = test_case.model_cls.prepare_model_and_inputs()
499-
model, inputs = _to_bfloat16(model, inputs)
487+
model, inputs = to_bfloat16(model, inputs)
500488
mxfp_config = MXFPOpConfig(weight_dtype=torch.float8_e4m3fn)
501489

502490
with torch.no_grad():
@@ -573,7 +561,7 @@ def test_deepseek_r1_distill_qwen_vgf_no_quant_bf16(
573561
test_case: DeepSeekR1DistillQwenTestCase,
574562
):
575563
model, inputs = test_case.model_cls.prepare_model_and_inputs()
576-
model, inputs = _to_bfloat16(model, inputs)
564+
model, inputs = to_bfloat16(model, inputs)
577565
with torch.no_grad():
578566
pipeline = VgfPipeline[input_t](
579567
model,
@@ -600,7 +588,7 @@ def test_deepseek_r1_distill_qwen_vgf_no_quant_bf16_xlarge(
600588
test_case: DeepSeekR1DistillQwenTestCase,
601589
):
602590
model, inputs = test_case.model_cls.prepare_model_and_inputs()
603-
model, inputs = _to_bfloat16(model, inputs)
591+
model, inputs = to_bfloat16(model, inputs)
604592
with torch.no_grad():
605593
pipeline = VgfPipeline[input_t](
606594
model,

0 commit comments

Comments
 (0)