Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit c534161

Browse files
author
George Ohashi
committed
uncomment
1 parent 27a2b72 commit c534161

File tree

1 file changed

+109
-109
lines changed

1 file changed

+109
-109
lines changed

tests/sparsezoo/model/test_model.py

Lines changed: 109 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -49,125 +49,125 @@
4949
files_yolo = copy.copy(files_ic)
5050

5151

52-
# @pytest.mark.parametrize(
53-
# "stub, args, should_pass",
54-
# [
55-
# (
56-
# "zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
57-
# "pruned-moderate",
58-
# ("recipe", "transfer_learn"),
59-
# True,
60-
# ),
61-
# (
62-
# "zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
63-
# "pruned-moderate",
64-
# ("checkpoint", "some_dummy_name"),
65-
# False,
66-
# ),
67-
# (
68-
# "zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
69-
# "pruned-moderate",
70-
# ("deployment", "default"),
71-
# True,
72-
# ),
73-
# (
74-
# "zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
75-
# "pruned-moderate",
76-
# ("checkpoint", "preqat"),
77-
# True,
78-
# ),
79-
# (
80-
# "zoo:nlp/question_answering/bert-base/pytorch/huggingface/squad/"
81-
# "12layer_pruned80_quant-none-vnni",
82-
# ("checkpoint", "postqat"),
83-
# True,
84-
# ),
85-
# (
86-
# "resnet_v1-50-imagenet-base",
87-
# ("deployment", "default"),
88-
# True,
89-
# ),
90-
# (
91-
# "bert-large-qqp_wikipedia_bookcorpus-pruned80.4block_quantized",
92-
# ("deployment", "default"),
93-
# True,
94-
# ),
95-
# (
96-
# "yolov5-n6-voc_coco-pruned55",
97-
# ("deployment", "default"),
98-
# True,
99-
# ),
100-
# ],
101-
# scope="function",
102-
# )
103-
# class TestSetupModel:
104-
# @pytest.fixture()
105-
# def setup(self, stub, args, should_pass):
106-
# temp_dir = tempfile.TemporaryDirectory(dir="/tmp")
52+
@pytest.mark.parametrize(
53+
"stub, args, should_pass",
54+
[
55+
(
56+
"zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
57+
"pruned-moderate",
58+
("recipe", "transfer_learn"),
59+
True,
60+
),
61+
(
62+
"zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
63+
"pruned-moderate",
64+
("checkpoint", "some_dummy_name"),
65+
False,
66+
),
67+
(
68+
"zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
69+
"pruned-moderate",
70+
("deployment", "default"),
71+
True,
72+
),
73+
(
74+
"zoo:cv/classification/mobilenet_v1-1.0/pytorch/sparseml/imagenet/"
75+
"pruned-moderate",
76+
("checkpoint", "preqat"),
77+
True,
78+
),
79+
(
80+
"zoo:nlp/question_answering/bert-base/pytorch/huggingface/squad/"
81+
"12layer_pruned80_quant-none-vnni",
82+
("checkpoint", "postqat"),
83+
True,
84+
),
85+
(
86+
"resnet_v1-50-imagenet-base",
87+
("deployment", "default"),
88+
True,
89+
),
90+
(
91+
"bert-large-qqp_wikipedia_bookcorpus-pruned80.4block_quantized",
92+
("deployment", "default"),
93+
True,
94+
),
95+
(
96+
"yolov5-n6-voc_coco-pruned55",
97+
("deployment", "default"),
98+
True,
99+
),
100+
],
101+
scope="function",
102+
)
103+
class TestSetupModel:
104+
@pytest.fixture()
105+
def setup(self, stub, args, should_pass):
106+
temp_dir = tempfile.TemporaryDirectory(dir="/tmp")
107107

108-
# yield stub, args, should_pass
108+
yield stub, args, should_pass
109109

110-
# shutil.rmtree(temp_dir.name)
110+
shutil.rmtree(temp_dir.name)
111111

112-
# def test_model_from_stub(self, stub, args, should_pass):
113-
# temp_dir = tempfile.TemporaryDirectory(dir="/tmp")
114-
# path = stub + "?" + args[0] + "=" + args[1]
115-
# if should_pass:
116-
# model = Model(path, temp_dir.name)
117-
# self._assert_correct_files_downloaded(model, args)
118-
# self._assert_validation_results_exist(model)
119-
# assert model.compressed_size
120-
# else:
121-
# with pytest.raises(ValueError):
122-
# Model(path)
112+
def test_model_from_stub(self, stub, args, should_pass):
113+
temp_dir = tempfile.TemporaryDirectory(dir="/tmp")
114+
path = stub + "?" + args[0] + "=" + args[1]
115+
if should_pass:
116+
model = Model(path, temp_dir.name)
117+
self._assert_correct_files_downloaded(model, args)
118+
self._assert_validation_results_exist(model)
119+
assert model.compressed_size
120+
else:
121+
with pytest.raises(ValueError):
122+
Model(path)
123123

124-
# @staticmethod
125-
# def _assert_correct_files_downloaded(model, args):
126-
# if args[0] == "recipe":
127-
# assert len(model.recipes.available) == 1
128-
# elif args[0] == "checkpoint":
129-
# assert len(model.training.available) == 1
130-
# elif args[0] == "deployment":
131-
# assert len(model.training.available) == 1
124+
@staticmethod
125+
def _assert_correct_files_downloaded(model, args):
126+
if args[0] == "recipe":
127+
assert len(model.recipes.available) == 1
128+
elif args[0] == "checkpoint":
129+
assert len(model.training.available) == 1
130+
elif args[0] == "deployment":
131+
assert len(model.training.available) == 1
132132

133-
# @staticmethod
134-
# def _assert_validation_results_exist(model):
135-
# assert model.validation_results is not None
136-
# assert isinstance(model.validation_results, dict)
137-
# assert len(model.validation_results.keys()) >= 1
138-
# assert any(value for value in model.validation_results.values())
133+
@staticmethod
134+
def _assert_validation_results_exist(model):
135+
assert model.validation_results is not None
136+
assert isinstance(model.validation_results, dict)
137+
assert len(model.validation_results.keys()) >= 1
138+
assert any(value for value in model.validation_results.values())
139139

140140

141141
@pytest.mark.parametrize(
142142
"stub, clone_sample_outputs, expected_files",
143143
[
144-
# (
145-
# (
146-
# "zoo:"
147-
# "cv/classification/mobilenet_v1-1.0/"
148-
# "pytorch/sparseml/imagenet/pruned-moderate"
149-
# ),
150-
# True,
151-
# files_ic,
152-
# ),
153-
# (
154-
# (
155-
# "zoo:"
156-
# "nlp/question_answering/distilbert-none/"
157-
# "pytorch/huggingface/squad/pruned80_quant-none-vnni"
158-
# ),
159-
# False,
160-
# files_nlp,
161-
# ),
162-
# (
163-
# (
164-
# "zoo:"
165-
# "cv/detection/yolov5-s/"
166-
# "pytorch/ultralytics/coco/pruned_quant-aggressive_94"
167-
# ),
168-
# True,
169-
# files_yolo,
170-
# ),
144+
(
145+
(
146+
"zoo:"
147+
"cv/classification/mobilenet_v1-1.0/"
148+
"pytorch/sparseml/imagenet/pruned-moderate"
149+
),
150+
True,
151+
files_ic,
152+
),
153+
(
154+
(
155+
"zoo:"
156+
"nlp/question_answering/distilbert-none/"
157+
"pytorch/huggingface/squad/pruned80_quant-none-vnni"
158+
),
159+
False,
160+
files_nlp,
161+
),
162+
(
163+
(
164+
"zoo:"
165+
"cv/detection/yolov5-s/"
166+
"pytorch/ultralytics/coco/pruned_quant-aggressive_94"
167+
),
168+
True,
169+
files_yolo,
170+
),
171171
(
172172
"resnet_v1-50-imagenet-channel20_pruned75.4block_quantized",
173173
False,

0 commit comments

Comments
 (0)