Skip to content

Commit

Permalink
Set device as CPU in failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klane committed Apr 29, 2024
1 parent f6d9c97 commit f254258
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:

- name: Run tests
run: poetry run pytest tests/ --cov=torchts
env:
PYTORCH_MPS_HIGH_WATERMARK_RATIO: 0.0

- name: Generate coverage report
run: poetry run coverage xml
Expand Down
1 change: 1 addition & 0 deletions tests/nn/test_ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def test_step_backward(euler_model):
def test_fit(euler_model):
"""Test the step and backward function"""
torch.manual_seed(0)
torch.set_default_device("cpu")
model, _ = euler_model
model.fit(torch.Tensor([[1.0]]), torch.Tensor([[1.1]]), max_epochs=1, batch_size=1)
coeffs = model.get_coeffs()
Expand Down
1 change: 1 addition & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_step(mocker):

def test_train():
torch.manual_seed(0)
torch.set_default_device("cpu")

slope_init = 2
intercept_init = -1
Expand Down

0 comments on commit f254258

Please sign in to comment.