-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathtest_UNet.py
More file actions
35 lines (27 loc) · 1.15 KB
/
test_UNet.py
File metadata and controls
35 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
"""Tests for the UNet implementation."""
from pathlib import Path
import pytest
from examples_tests.test_util import SubProcessChecker
current_path = Path(__file__).parent
class UNetTest(SubProcessChecker):
def setUp(self):
self.run_command("make", current_path, [])
"""Test training command line executions."""
@pytest.mark.ipus(4)
def test_train(self):
"""Test the training on 4 IPUs"""
self.run_command(
"python3 main.py --nb-ipus-per-replica 4 --micro-batch-size 1 --gradient-accumulation-count 24 --num-epochs 20 --train --augment --learning-rate 0.0001 --host-generated-data",
current_path,
["Training complete"],
)
"""Test inference command line executions."""
@pytest.mark.ipus(4)
def test_infer(self):
"""Test the inference on 4 IPUs"""
self.run_command(
"python3 main.py --nb-ipus-per-replica 1 --replicas 4 --micro-batch-size 2 --gradient-accumulation-count 1 --infer --host-generated-data --benchmark",
current_path,
["Inference complete"],
)