Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistecolle committed Oct 14, 2024
1 parent be34484 commit cc3b6dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/pytorch_bert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defaults:
- _base_
- _self_

name: pytorch_bert_YE&(@!&)
name: pytorch_bert

launcher:
device_isolation: true
Expand Down
14 changes: 13 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
from logging import getLogger
from pathlib import Path
import yaml

import pytest

Expand Down Expand Up @@ -106,8 +107,19 @@
f"In ALL_PYTHON_SCRIPTS but not in PYTHON_SCRIPTS: {set(ALL_PYTHON_SCRIPTS) - set(PYTHON_SCRIPTS)}"
)

def extract_name_from_yaml(config_name):
config_path = EXAMPLES_DIR / config_name

with open(config_path, "r") as f:
yaml_content = f.read()

data = yaml.safe_load(yaml_content)

return data.get('name')

def test_yaml_config(config_name):
name = extract_name_from_yaml(config_name)

args = [
"optimum-benchmark",
"--config-dir",
Expand All @@ -120,7 +132,7 @@ def test_yaml_config(config_name):
assert popen.returncode == 0, f"Failed to run {config_name}"

# Check if the benchmark produced any output
output_dir = Path(OUTPUT_DIR) / config_name.split(".")[0]
output_dir = Path(OUTPUT_DIR) / name
assert output_dir.exists(), f"No output directory found for {config_name}"

# Check if there's at least one file in the output directory
Expand Down

0 comments on commit cc3b6dc

Please sign in to comment.