[diffusion] chore: reuse srt siglip vision model (#34988)
This commit is contained in:
@@ -52,6 +52,39 @@ def test_npu_backend_selection_priority(
|
||||
assert backend == expected
|
||||
|
||||
|
||||
def test_explicit_backend_without_published_mm_context(monkeypatch, npu_platform):
|
||||
monkeypatch.setattr(
|
||||
vision,
|
||||
"get_mm",
|
||||
Mock(side_effect=ValueError("config namespace 'mm' not published")),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
vision,
|
||||
"get_context",
|
||||
lambda: SimpleNamespace(is_config_namespace_published=lambda namespace: False),
|
||||
)
|
||||
|
||||
backend = vision.VisionAttention._determine_attention_backend(None, "sdpa")
|
||||
|
||||
assert backend == "sdpa"
|
||||
|
||||
|
||||
def test_explicit_backend_keeps_published_context_errors(monkeypatch, npu_platform):
|
||||
monkeypatch.setattr(
|
||||
vision,
|
||||
"get_mm",
|
||||
Mock(side_effect=ValueError("mm namespace is not available for this role")),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
vision,
|
||||
"get_context",
|
||||
lambda: SimpleNamespace(is_config_namespace_published=lambda namespace: True),
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="not available for this role"):
|
||||
vision.VisionAttention._determine_attention_backend(None, "sdpa")
|
||||
|
||||
|
||||
def test_sdpa_preserves_flattened_batch_layout():
|
||||
torch.manual_seed(0)
|
||||
bsz, seq_len, num_heads, head_dim = 3, 5, 2, 8
|
||||
|
||||
Reference in New Issue
Block a user