Skip to content

Commit

Permalink
Run set_device_arm_macos_ci on all darwin platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed May 30, 2024
1 parent a25b9f1 commit 9a70828
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys

import pytest
import torch
Expand All @@ -18,15 +19,10 @@ def set_device_arm_macos_ci():
GitHub runners. This is to avoid the following error:
https://discuss.pytorch.org/t/mps-back-end-out-of-memory-on-github-action/189773/5
"""
if (
os.getenv("GITHUB_ACTIONS") == "true"
and torch.backends.mps.is_available()
):
if sys.platform == "darwin" and torch.backends.mps.is_available():
import keras

Check warning on line 23 in tests/conftest.py

View check run for this annotation

Codecov / codecov/patch

tests/conftest.py#L23

Added line #L23 was not covered by tests
import tensorflow

keras.src.backend.common.global_state.set_global_attribute(

Check warning on line 25 in tests/conftest.py

View check run for this annotation

Codecov / codecov/patch

tests/conftest.py#L25

Added line #L25 was not covered by tests
"torch_device", "cpu"
)
tensorflow.config.set_visible_devices([], "GPU")
# force_cpu()

0 comments on commit 9a70828

Please sign in to comment.