Skip to content

Commit 29ab7f8

Browse files
committed
Switch to (Re)TestItems
1 parent de4f684 commit 29ab7f8

File tree

10 files changed

+203
-191
lines changed

10 files changed

+203
-191
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ steps:
1313
queue: "juliagpu"
1414
cuda: "*"
1515
env:
16-
GROUP: "CUDA"
16+
GROUP: "CUDA" # TODO there are zero tests under this group
1717
if: build.message !~ /\[skip tests\]/
1818
timeout_in_minutes: 180
1919
matrix:

.github/workflows/CI.yml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
test:
2525
name: ${{ matrix.suite }} - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
2626
runs-on: ${{ matrix.os }}
27+
env:
28+
GROUP: ${{ matrix.suite }}
2729
strategy:
2830
fail-fast: false
2931
matrix:
@@ -37,18 +39,19 @@ jobs:
3739
arch:
3840
- x64
3941
suite:
40-
- '["AlexNet", "VGG"]'
41-
- '["GoogLeNet", "SqueezeNet", "MobileNets"]'
42-
- '"EfficientNet"'
43-
- 'r"/*/ResNet*"'
44-
- 'r"/*/SEResNet*"'
45-
- '[r"Res2Net", r"Res2NeXt"]'
46-
- '"Inception"'
47-
- '"DenseNet"'
48-
- '"UNet"'
49-
- '["ConvNeXt", "ConvMixer"]'
50-
- 'r"Mixers"'
51-
- 'r"ViTs"'
42+
- 'AlexNet|VGG'
43+
- 'GoogLeNet|SqueezeNet|MobileNet|MNASNet'
44+
- 'EfficientNet'
45+
- 'ResNet|WideResNet'
46+
- 'ResNeXt' # split off from ResNet to reduce overall runtime
47+
- 'SEResNet|SEResNeXt'
48+
- 'Res2Net|Res2NeXt'
49+
- 'Inception'
50+
- 'DenseNet'
51+
- 'UNet'
52+
- 'ConvNeXt|ConvMixer'
53+
- 'Mixers'
54+
- 'ViTs'
5255
steps:
5356
- uses: actions/checkout@v3
5457
- uses: julia-actions/setup-julia@v1
@@ -57,28 +60,22 @@ jobs:
5760
arch: ${{ matrix.arch }}
5861
- uses: julia-actions/cache@v1
5962
- uses: julia-actions/julia-buildpkg@v1
60-
- name: "Setup environment"
61-
run: |
62-
julia --project=./test -e 'using Pkg; Pkg.develop(path = ".")'
63-
- name: "Run tests + coverage"
64-
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
65-
run: |
66-
julia --code-coverage=user --color=yes --depwarn=yes --project=./test -e 'include("test/retest.jl"); retest(${{ matrix.suite }})'
67-
shell: bash
68-
- name: "Run tests only"
69-
if: ${{ !(matrix.version == '1' && matrix.os == 'ubuntu-latest') }}
70-
run: |
71-
julia --color=yes --depwarn=yes --project=./test -e 'include("test/retest.jl"); retest(${{ matrix.suite }})'
72-
continue-on-error: ${{ matrix.version == 'nightly' }}
73-
shell: bash
63+
64+
- name: Run tests
65+
uses: julia-actions/julia-runtest@v1
66+
continue-on-error: ${{ !(matrix.version == '1' && matrix.os == 'ubuntu-latest') && matrix.version == 'nightly' }}
67+
with:
68+
coverage: ${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' }}
69+
# run: |
70+
# julia --color=yes --depwarn=yes --project=./test -e 'include("test/retest.jl"); retest(${{ matrix.suite }})'
7471
- uses: actions/upload-artifact@v3
7572
with:
7673
name: coverage-${{ hashFiles('**/*.cov') }}
7774
path: '**/*.cov'
7875
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
7976

8077
coverage:
81-
name: "Coverage"
78+
name: Coverage
8279
runs-on: ubuntu-latest
8380
needs: test
8481
steps:
@@ -94,7 +91,7 @@ jobs:
9491
cp -r coverage-*/* .
9592
rm -rf coverage-*
9693
- uses: julia-actions/julia-processcoverage@v1
97-
- uses: codecov/codecov-action@v2
94+
- uses: codecov/codecov-action@v3
9895
with:
9996
file: lcov.info
10097

test/Project.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,16 @@
22
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
33
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
44
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
5-
ReTest = "e0db7c4e-2690-44b9-bad6-7687da720f89"
5+
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
66
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7+
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
8+
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
9+
10+
[compat]
11+
CUDA = "4, 5"
12+
Flux = "0.13.16, 0.14"
13+
Images = "0.26"
14+
Test = "1"
15+
TestItems = "0.1"
16+
ReTestItems = "1"
17+
cuDNN = "1"

test/convnets.jl renamed to test/convnet_tests.jl

Lines changed: 45 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
@testset "AlexNet" begin
1+
@testitem "AlexNet" setup=[TestModels] begin
22
model = AlexNet()
33
@test size(model(x_256)) == (1000, 1)
44
@test_throws ArgumentError AlexNet(pretrain = true)
55
@test gradtest(model, x_256)
66
_gc()
77
end
88

9-
@testset "VGG" begin
9+
@testitem "VGG" setup=[TestModels] begin
1010
@testset "VGG($sz, batchnorm=$bn)" for sz in [11, 13, 16, 19], bn in [true, false]
1111
m = VGG(sz, batchnorm = bn)
1212
@test size(m(x_224)) == (1000, 1)
@@ -20,7 +20,7 @@ end
2020
end
2121
end
2222

23-
@testset "ResNet" begin
23+
@testitem "ResNet" setup=[TestModels] begin
2424
# Tests for pretrained ResNets
2525
@testset "ResNet($sz)" for sz in [18, 34, 50, 101, 152]
2626
m = ResNet(sz)
@@ -58,7 +58,7 @@ end
5858
end
5959

6060

61-
@testset "WideResNet" begin
61+
@testitem "WideResNet" setup=[TestModels] begin
6262
@testset "WideResNet($sz)" for sz in [50, 101]
6363
m = WideResNet(sz)
6464
@test size(m(x_224)) == (1000, 1)
@@ -72,7 +72,7 @@ end
7272
end
7373
end
7474

75-
@testset "ResNeXt" begin
75+
@testitem "ResNeXt" setup=[TestModels] begin
7676
@testset for depth in [50, 101, 152]
7777
@testset for cardinality in [32, 64]
7878
@testset for base_width in [4, 8]
@@ -90,7 +90,7 @@ end
9090
end
9191
end
9292

93-
@testset "SEResNet" begin
93+
@testitem "SEResNet" setup=[TestModels] begin
9494
@testset for depth in [18, 34, 50, 101, 152]
9595
m = SEResNet(depth)
9696
@test size(m(x_224)) == (1000, 1)
@@ -104,7 +104,7 @@ end
104104
end
105105
end
106106

107-
@testset "SEResNeXt" begin
107+
@testitem "SEResNeXt" setup=[TestModels] begin
108108
@testset for depth in [50, 101, 152]
109109
@testset for cardinality in [32, 64]
110110
@testset for base_width in [4, 8]
@@ -122,7 +122,7 @@ end
122122
end
123123
end
124124

125-
@testset "Res2Net" begin
125+
@testitem "Res2Net" setup=[TestModels] begin
126126
@testset for (base_width, scale) in [(26, 4), (48, 2), (14, 8), (26, 6), (26, 8)]
127127
m = Res2Net(50; base_width, scale)
128128
@test size(m(x_224)) == (1000, 1)
@@ -147,7 +147,7 @@ end
147147
end
148148
end
149149

150-
@testset "Res2NeXt" begin
150+
@testitem "Res2NeXt" setup=[TestModels] begin
151151
@testset for depth in [50, 101]
152152
m = Res2NeXt(depth)
153153
@test size(m(x_224)) == (1000, 1)
@@ -161,7 +161,7 @@ end
161161
end
162162
end
163163

164-
@testset "EfficientNet" begin
164+
@testitem "EfficientNet" setup=[TestModels] begin
165165
@testset "EfficientNet($config)" for config in [:b0, :b1, :b2, :b3, :b4, :b5,] #:b6, :b7, :b8]
166166
# preferred image resolution scaling
167167
r = Metalhead.EFFICIENTNET_GLOBAL_CONFIGS[config][1]
@@ -178,7 +178,7 @@ end
178178
end
179179
end
180180

181-
@testset "EfficientNetv2" begin
181+
@testitem "EfficientNetv2" setup=[TestModels] begin
182182
@testset for config in [:small, :medium, :large] # :xlarge]
183183
m = EfficientNetv2(config)
184184
@test size(m(x_224)) == (1000, 1)
@@ -192,7 +192,7 @@ end
192192
end
193193
end
194194

195-
@testset "GoogLeNet" begin
195+
@testitem "GoogLeNet" setup=[TestModels] begin
196196
@testset for bn in [true, false]
197197
m = GoogLeNet(batchnorm = bn)
198198
@test size(m(x_224)) == (1000, 1)
@@ -206,55 +206,22 @@ end
206206
end
207207
end
208208

209-
@testset "Inception" begin
209+
@testitem "Inception" setup=[TestModels] begin
210210
x_299 = rand(Float32, 299, 299, 3, 2)
211-
@testset "Inceptionv3" begin
212-
m = Inceptionv3()
211+
@testset "$Model" for Model in [Inceptionv3, Inceptionv4, InceptionResNetv2, Xception]
212+
m = Model()
213213
@test size(m(x_299)) == (1000, 2)
214-
if Inceptionv3 in PRETRAINED_MODELS
215-
@test acctest(Inceptionv3(pretrain = true))
214+
if Model in PRETRAINED_MODELS
215+
@test acctest(Model(pretrain = true))
216216
else
217-
@test_throws ArgumentError Inceptionv3(pretrain = true)
218-
end
219-
@test gradtest(m, x_299)
220-
end
221-
_gc()
222-
@testset "Inceptionv4" begin
223-
m = Inceptionv4()
224-
@test size(m(x_299)) == (1000, 2)
225-
if Inceptionv4 in PRETRAINED_MODELS
226-
@test acctest(Inceptionv4(pretrain = true))
227-
else
228-
@test_throws ArgumentError Inceptionv4(pretrain = true)
229-
end
230-
@test gradtest(m, x_299)
231-
end
232-
_gc()
233-
@testset "InceptionResNetv2" begin
234-
m = InceptionResNetv2()
235-
@test size(m(x_299)) == (1000, 2)
236-
if InceptionResNetv2 in PRETRAINED_MODELS
237-
@test acctest(InceptionResNetv2(pretrain = true))
238-
else
239-
@test_throws ArgumentError InceptionResNetv2(pretrain = true)
240-
end
241-
@test gradtest(m, x_299)
242-
end
243-
_gc()
244-
@testset "Xception" begin
245-
m = Xception()
246-
@test size(m(x_299)) == (1000, 2)
247-
if Xception in PRETRAINED_MODELS
248-
@test acctest(Xception(pretrain = true))
249-
else
250-
@test_throws ArgumentError Xception(pretrain = true)
217+
@test_throws ArgumentError Model(pretrain = true)
251218
end
252219
@test gradtest(m, x_299)
220+
_gc()
253221
end
254-
_gc()
255222
end
256223

257-
@testset "SqueezeNet" begin
224+
@testitem "SqueezeNet" setup=[TestModels] begin
258225
m = SqueezeNet()
259226
@test size(m(x_224)) == (1000, 1)
260227
if SqueezeNet in PRETRAINED_MODELS
@@ -266,7 +233,7 @@ end
266233
_gc()
267234
end
268235

269-
@testset "DenseNet" begin
236+
@testitem "DenseNet" setup=[TestModels] begin
270237
@testset for sz in [121, 161, 169, 201]
271238
m = DenseNet(sz)
272239
@test size(m(x_224)) == (1000, 1)
@@ -280,8 +247,13 @@ end
280247
end
281248
end
282249

283-
@testset "MobileNets (width = $width_mult)" for width_mult in [0.5, 0.75, 1, 1.3]
284-
@testset "MobileNetv1" begin
250+
@testsetup module TestMobileNets
251+
export WIDTH_MULTS
252+
const WIDTH_MULTS = [0.5, 0.75, 1.0, 1.3]
253+
end
254+
255+
@testitem "MobileNetsV1" setup=[TestModels, TestMobileNets] begin
256+
@testset for width_mult in WIDTH_MULTS
285257
m = MobileNetv1(width_mult)
286258
@test size(m(x_224)) == (1000, 1)
287259
if (MobileNetv1, width_mult) in PRETRAINED_MODELS
@@ -290,9 +262,12 @@ end
290262
@test_throws ArgumentError MobileNetv1(pretrain = true)
291263
end
292264
@test gradtest(m, x_224)
265+
_gc()
293266
end
294-
_gc()
295-
@testset "MobileNetv2" begin
267+
end
268+
269+
@testitem "MobileNetv2" setup=[TestModels, TestMobileNets] begin
270+
@testset for width_mult in WIDTH_MULTS
296271
m = MobileNetv2(width_mult)
297272
@test size(m(x_224)) == (1000, 1)
298273
if (MobileNetv2, width_mult) in PRETRAINED_MODELS
@@ -302,8 +277,11 @@ end
302277
end
303278
@test gradtest(m, x_224)
304279
end
305-
_gc()
306-
@testset "MobileNetv3" verbose = true begin
280+
end
281+
282+
283+
@testitem "MobileNetv3" setup=[TestModels, TestMobileNets] begin
284+
@testset for width_mult in WIDTH_MULTS
307285
@testset for config in [:small, :large]
308286
m = MobileNetv3(config; width_mult)
309287
@test size(m(x_224)) == (1000, 1)
@@ -316,7 +294,10 @@ end
316294
_gc()
317295
end
318296
end
319-
@testset "MNASNet" verbose = true begin
297+
end
298+
299+
@testitem "MNASNet" setup=[TestModels, TestMobileNets] begin
300+
@testset for width in WIDTH_MULTS
320301
@testset for config in [:A1, :B1]
321302
m = MNASNet(config; width_mult)
322303
@test size(m(x_224)) == (1000, 1)
@@ -331,7 +312,7 @@ end
331312
end
332313
end
333314

334-
@testset "ConvNeXt" verbose = true begin
315+
@testitem "ConvNeXt" setup=[TestModels] begin
335316
@testset for config in [:small, :base, :large, :tiny, :xlarge]
336317
m = ConvNeXt(config)
337318
@test size(m(x_224)) == (1000, 1)
@@ -340,7 +321,7 @@ end
340321
end
341322
end
342323

343-
@testset "ConvMixer" verbose = true begin
324+
@testitem "ConvMixer" setup=[TestModels] begin
344325
@testset for config in [:small, :base, :large]
345326
m = ConvMixer(config)
346327
@test size(m(x_224)) == (1000, 1)
@@ -349,7 +330,7 @@ end
349330
end
350331
end
351332

352-
@testset "UNet" begin
333+
@testitem "UNet" setup=[TestModels] begin
353334
encoder = Metalhead.backbone(ResNet(18))
354335
model = UNet((256, 256), 3, 10, encoder)
355336
@test size(model(x_256)) == (256, 256, 10, 1)

0 commit comments

Comments
 (0)