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 regression tests #1408

Merged
merged 5 commits into from
Aug 30, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import os
import torch

from super_gradients.common.environment.checkpoints_dir_utils import get_checkpoints_dir_path
from super_gradients.common.environment.checkpoints_dir_utils import get_latest_run_dir_path
Louis-Dupont marked this conversation as resolved.
Show resolved Hide resolved


# IMPORTANT NOTE: These tests will pass only after calling "install requirements and run recipe tests" run from .circleci/config.yml
class ShortenedRecipesAccuracyTests(unittest.TestCase):
@classmethod
def setUp(cls):
Expand All @@ -20,7 +21,7 @@ def test_shortened_cifar10_resnet_accuracy(self):
self.assertTrue(self._reached_goal_metric(experiment_name="shortened_cifar10_resnet_accuracy_test", metric_value=0.9167, delta=0.05))

def test_convert_shortened_cifar10_resnet(self):
ckpt_dir = get_checkpoints_dir_path(experiment_name="shortened_cifar10_resnet_accuracy_test")
ckpt_dir = get_latest_run_dir_path(experiment_name="shortened_cifar10_resnet_accuracy_test")
self.assertTrue(os.path.exists(os.path.join(ckpt_dir, "ckpt_best.onnx")))

def test_shortened_coco2017_yolox_n_map(self):
Expand All @@ -34,7 +35,7 @@ def test_shortened_coco_dekr_32_ap_test(self):

@classmethod
def _reached_goal_metric(cls, experiment_name: str, metric_value: float, delta: float):
checkpoints_dir_path = get_checkpoints_dir_path(experiment_name=experiment_name)
checkpoints_dir_path = get_latest_run_dir_path(experiment_name=experiment_name)
sd = torch.load(os.path.join(checkpoints_dir_path, "ckpt_best.pth"))
metric_val_reached = sd["acc"].cpu().item()
diff = abs(metric_val_reached - metric_value)
Expand All @@ -47,7 +48,7 @@ def _reached_goal_metric(cls, experiment_name: str, metric_value: float, delta:
def tearDownClass(cls) -> None:
# ERASE ALL THE FOLDERS THAT WERE CREATED DURING THIS TEST
for experiment_name in cls.experiment_names:
checkpoints_dir_path = get_checkpoints_dir_path(experiment_name=experiment_name)
checkpoints_dir_path = get_latest_run_dir_path(experiment_name=experiment_name)
if os.path.isdir(checkpoints_dir_path):
shutil.rmtree(checkpoints_dir_path)

Expand Down