Skip to content

Commit

Permalink
Move config["testconfig_path"] assignment (#895)
Browse files Browse the repository at this point in the history
* Use custom unique test names for e2e tests (#892)

* Include `testconfig_path` in parsed config data

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

* Use custom unique names for e2e tests

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

---------

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

* Revert "Use custom unique test names for e2e tests (#892)" (#893)

This reverts commit 10facf2.

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

* Move config["testconfig_path"] assignment

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

* Use a function name generator for e2e test names

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>

---------

Signed-off-by: Domenic Barbuzzi <domenic@neuralmagic.com>
Co-authored-by: Dipika Sikka <dipikasikka1@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
  • Loading branch information
2 people authored and kylesayrs committed Nov 21, 2024
1 parent dba61ec commit 4e126b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 15 additions & 2 deletions tests/e2e/vLLM/test_vllm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import shutil
import unittest
from typing import Callable

import pytest
from datasets import load_dataset
from parameterized import parameterized_class
from parameterized import parameterized, parameterized_class
from transformers import AutoTokenizer

from llmcompressor.modifiers.quantization import QuantizationModifier
Expand Down Expand Up @@ -32,10 +33,22 @@
CONFIGS = [WNA16, FP8, INT8, ACTORDER, WNA16_2of4]


def gen_test_name(testcase_func: Callable, param_num: int, param: dict) -> str:
return "_".join(
[
testcase_func.__name__,
parameterized.to_safe_name(
param.get("testconfig_path", "").split("configs/")[-1]
),
param.get("cadence", "").lower(),
]
)


@requires_gpu
@requires_torch
@pytest.mark.skipif(not vllm_installed, reason="vLLM is not installed, skipping test")
@parameterized_class(parse_params(CONFIGS))
@parameterized_class(parse_params(CONFIGS), class_name_func=gen_test_name)
class TestvLLM(unittest.TestCase):
"""
The following test quantizes a model using a preset scheme or recipe,
Expand Down
5 changes: 4 additions & 1 deletion tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ def _parse_configs_dir(current_config_dir):
), f"Config_directory {current_config_dir} is not a directory"

for file in os.listdir(current_config_dir):
config = _load_yaml(os.path.join(current_config_dir, file))
config_path = os.path.join(current_config_dir, file)
config = _load_yaml(config_path)
if not config:
continue

config["testconfig_path"] = config_path

cadence = os.environ.get("CADENCE", "commit")
expected_cadence = config.get("cadence")

Expand Down

0 comments on commit 4e126b3

Please sign in to comment.