test lazy also, make TestMNIST faster

This commit is contained in:
George Hotz
2022-07-03 15:18:00 -07:00
parent 64d986bc8b
commit d7aad46758
2 changed files with 9 additions and 3 deletions

View File

@@ -52,6 +52,8 @@ jobs:
run: pip install -e '.[testing]'
- name: Run Pytest
run: python -m pytest -s -v
- name: Run Pytest (lazy)
run: LAZY=1 python -m pytest -s -v
testtorch:
name: Torch Tests
@@ -70,6 +72,8 @@ jobs:
run: pip install -e '.[testing]'
- name: Run Pytest
run: TORCH=1 python -m pytest -s -v
- name: Run Pytest (lazy)
run: LAZY=1 TORCH=1 python -m pytest -s -v
testgpu:
name: GPU Tests
@@ -94,6 +98,8 @@ jobs:
run: pip install -e '.[gpu,testing]'
- name: Run Pytest
run: GPU=1 python -m pytest -s -v
- name: Run Pytest (lazy)
run: LAZY=1 GPU=1 python -m pytest -s -v
testmypy:
name: Mypy Tests

View File

@@ -81,21 +81,21 @@ class TestMNIST(unittest.TestCase):
np.random.seed(1337)
model = TinyConvNet()
optimizer = optim.Adam(model.parameters(), lr=0.001)
train(model, X_train, Y_train, optimizer, steps=200)
train(model, X_train, Y_train, optimizer, steps=100)
assert evaluate(model, X_test, Y_test) > 0.95
def test_sgd(self):
np.random.seed(1337)
model = TinyBobNet()
optimizer = optim.SGD(model.parameters(), lr=0.001)
train(model, X_train, Y_train, optimizer, steps=1000)
train(model, X_train, Y_train, optimizer, steps=600)
assert evaluate(model, X_test, Y_test) > 0.95
def test_rmsprop(self):
np.random.seed(1337)
model = TinyBobNet()
optimizer = optim.RMSprop(model.parameters(), lr=0.0002)
train(model, X_train, Y_train, optimizer, steps=1000)
train(model, X_train, Y_train, optimizer, steps=400)
assert evaluate(model, X_test, Y_test) > 0.95
if __name__ == '__main__':