Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recipe nested in configs #140

Merged
merged 9 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/e2e/vLLM/test_vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
except ImportError:
vllm_installed = False


CONFIGS = "tests/e2e/vLLM/configs"
# Defines the file paths to the directories containing the test configs
# for each of the quantization schemes
WNA16 = "tests/e2e/vLLM/configs/WNA16"
FP8 = "tests/e2e/vLLM/configs/FP8"
INT8 = "tests/e2e/vLLM/configs/INT8"
ACTORDER = "tests/e2e/vLLM/configs/actorder"
CONFIGS = [WNA16, FP8, INT8, ACTORDER]


@requires_gpu
Expand Down
88 changes: 41 additions & 47 deletions tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,54 +68,48 @@ def _validate_test_config(config: dict):
# Set cadence in the config. The environment must set if nightly, weekly or commit
# tests are running
def parse_params(
path: str, type: Optional[str] = None
configs_directory: Union[list, str], type: Optional[str] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you confirm that this runs the e2e tests correctly?

) -> List[Union[dict, CustomTestConfig]]:
"""
Collect parameters recursively from directory or file path

:param path: path to directory or config path
:param type: set to "custom" for custom script tests

:return: test configurations
:rtype: List[Union[dict, CustomTestConfig]]
"""
# recursive case
if os.path.isdir(path):
return sum(
(
parse_params(os.path.join(path, filename))
for filename in os.listdir(path)
if filename[0] != "."
),
start=[],
)

# load config yaml
config = _load_yaml(path)
if not config:
return []

# collect cadence
cadence = os.environ.get("CADENCE", "commit")
expected_cadence = config.get("cadence")
if not isinstance(expected_cadence, list):
expected_cadence = [expected_cadence]

# skip if cadence doesn't match
if cadence not in expected_cadence:
logging.debug(
f"Skipping testing model: {path} for cadence: {config['cadence']}"
)
return []

if type == "custom":
config = CustomTestConfig(**config)
elif not _validate_test_config(config):
raise ValueError(
"The config provided does not comply with the expected structure "
"See tests.data.TestConfig for the expected fields."
)
return [config]
# parses the config files provided

config_dicts = []

def _parse_configs_dir(current_config_dir):
assert os.path.isdir(
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))
if not config:
continue

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

if not isinstance(expected_cadence, list):
expected_cadence = [expected_cadence]
if cadence in expected_cadence:
if type == "custom":
config = CustomTestConfig(**config)
else:
if not _validate_test_config(config):
raise ValueError(
"The config provided does not comply with the expected "
"structure. See tests.data.TestConfig for the expected "
"fields."
)
config_dicts.append(config)
else:
logging.info(
f"Skipping testing model: {file} for cadence: {expected_cadence}"
)
if isinstance(configs_directory, list):
for config in configs_directory:
_parse_configs_dir(config)
else:
_parse_configs_dir(configs_directory)
return config_dicts


def run_cli_command(cmd: List[str]):
Expand Down
Loading