Skip to content

Commit

Permalink
Update code feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
chuneuny-emily committed Jun 21, 2024
1 parent be0d677 commit fe1dcca
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 64 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def pytest_addoption(parser: pytest.Parser):
)
parser.addoption(
"--deterministic",
action="store",
choices=["true", "false"],
default=None,
help="Turn on deterministic training (true/false).",
)
Expand Down
7 changes: 5 additions & 2 deletions tests/perf/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ def fxt_dry_run(request: pytest.FixtureRequest) -> str:


@pytest.fixture(scope="session")
def fxt_deterministic(request: pytest.FixtureRequest) -> str:
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Option to turn on deterministic training."""
return request.config.getoption("--deterministic")
deterministic = request.config.getoption("--deterministic")
deterministic = False if deterministic is None else deterministic == "true"
log.info(f"{deterministic=}")
return deterministic


@pytest.fixture(scope="session")
Expand Down
5 changes: 2 additions & 3 deletions tests/perf/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for action classification task."""
deterministic = request.config.getoption("--deterministic")
deterministic = True if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
deterministic = True if deterministic is None else deterministic == "true"
log.info(f"{deterministic=}")
return deterministic


Expand Down
13 changes: 0 additions & 13 deletions tests/perf/test_anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from __future__ import annotations

import logging
from pathlib import Path
from typing import ClassVar

Expand All @@ -14,18 +13,6 @@
from .benchmark import Benchmark
from .conftest import PerfTestBase

log = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for anomaly tasks."""
deterministic = request.config.getoption("--deterministic")
deterministic = False if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
return deterministic


class TestPerfAnomalyClassification(PerfTestBase):
"""Benchmark anomaly classification."""
Expand Down
5 changes: 2 additions & 3 deletions tests/perf/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for classification tasks."""
deterministic = request.config.getoption("--deterministic")
deterministic = True if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
deterministic = True if deterministic is None else deterministic == "true"
log.info(f"{deterministic=}")
return deterministic


Expand Down
5 changes: 2 additions & 3 deletions tests/perf/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for detection task."""
deterministic = request.config.getoption("--deterministic")
deterministic = True if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
deterministic = True if deterministic is None else deterministic == "true"
log.info(f"{deterministic=}")
return deterministic


Expand Down
13 changes: 0 additions & 13 deletions tests/perf/test_instance_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,13 @@

from __future__ import annotations

import logging
from pathlib import Path

import pytest

from .benchmark import Benchmark
from .conftest import PerfTestBase

log = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for instance segmentation task."""
deterministic = request.config.getoption("--deterministic")
deterministic = False if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
return deterministic


class TestPerfInstanceSegmentation(PerfTestBase):
"""Benchmark instance segmentation."""
Expand Down
13 changes: 0 additions & 13 deletions tests/perf/test_semantic_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,13 @@

from __future__ import annotations

import logging
from pathlib import Path

import pytest

from .benchmark import Benchmark
from .conftest import PerfTestBase

log = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for semantic segmentation task."""
deterministic = request.config.getoption("--deterministic")
deterministic = False if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
return deterministic


class TestPerfSemanticSegmentation(PerfTestBase):
"""Benchmark semantic segmentation."""
Expand Down
13 changes: 0 additions & 13 deletions tests/perf/test_visual_prompting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,13 @@

from __future__ import annotations

import logging
from pathlib import Path

import pytest

from .benchmark import Benchmark
from .conftest import PerfTestBase

log = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def fxt_deterministic(request: pytest.FixtureRequest) -> bool:
"""Override the deterministic setting for visual prompting task."""
deterministic = request.config.getoption("--deterministic")
deterministic = False if deterministic is None else deterministic.lower() == "true"
msg = f"deterministic={deterministic}"
log.info(msg)
return deterministic


class TestPerfVisualPrompting(PerfTestBase):
"""Benchmark visual prompting."""
Expand Down

0 comments on commit fe1dcca

Please sign in to comment.