Skip to content

Commit

Permalink
Skip phimoe test if conditions are not met.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Aug 27, 2024
1 parent 8eded12 commit 81ce3be
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/models/test_phimoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Run `pytest tests/models/test_phimoe.py`.
"""
import pytest
import torch

from vllm.utils import is_cpu

from .utils import check_logprobs_close

Expand All @@ -12,8 +15,6 @@


def test_phimoe_routing_function():
import torch

from vllm.model_executor.models.phimoe import phimoe_routing_function
test_case = {
0: {
Expand Down Expand Up @@ -68,6 +69,20 @@ def test_phimoe_routing_function():
assert torch.equal(topk_ids, ground_truth[test_id]["topk_ids"])


def get_gpu_memory():
try:
props = torch.cuda.get_device_properties(torch.cuda.current_device())
gpu_memory = props.total_memory / (1024**3)
return gpu_memory
except Exception:
return 0


@pytest.mark.skipif(condition=is_cpu(),
reason="This test takes a lot time to run on CPU, "
"and vllm CI's disk space is not enough for this model.")
@pytest.mark.skipif(condition=get_gpu_memory() < 100,
reason="Skip this test if GPU memory is insufficient.")
@pytest.mark.parametrize("model", MODELS)
@pytest.mark.parametrize("dtype", ["bfloat16"])
@pytest.mark.parametrize("max_tokens", [64])
Expand Down

0 comments on commit 81ce3be

Please sign in to comment.