Skip to content

Commit

Permalink
debug macos tests (#291)
Browse files Browse the repository at this point in the history
* debug macos tests

* update workflows

* update tree_method

* fix covnet test issue introduced

* set macosx deployment target = 10.13

* clean up
  • Loading branch information
robsdavis authored Sep 13, 2024
1 parent abae817 commit a856d6b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10"]
python-version: ["3.11"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10"]
python-version: ["3.11"]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -47,19 +47,31 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
- name: Install MacOS dependencies
- name: Set libomp environment variables (macOS only)
run: |
brew install libomp
if: ${{ matrix.os == 'macos-latest' }}
LIBOMP_PATH="/opt/homebrew/opt/libomp"
echo "LDFLAGS=-L${LIBOMP_PATH}/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I${LIBOMP_PATH}/include" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=${LIBOMP_PATH}/lib:\$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "OMP_PATH=${LIBOMP_PATH}/include" >> $GITHUB_ENV
if: ${{ runner.os == 'macOS' }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -r prereq.txt
- name: Limit OpenMP threads (Critical for macOS else it can hang without error)
run: |
echo "OMP_NUM_THREADS=2" >> $GITHUB_ENV
- name: Test Core
run: |
pip install .[testing]
pip freeze
pytest -vvvsx -m "not slow" --durations=50
- name: Set macOS deployment target
run: |
echo "MACOSX_DEPLOYMENT_TARGET=10.13" >> $GITHUB_ENV
if: ${{ runner.os == 'macOS' }}
- name: Test GOGGLE
run: |
pip install .[testing,goggle]
Expand Down
1 change: 1 addition & 0 deletions src/synthcity/metrics/eval_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ def evaluate(

elif self._task_type == "classification":
model = XGBClassifier(
tree_method="approx",
n_jobs=2,
verbosity=0,
depth=3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def _fit(
raise ValueError(f"unsupported strategy {self.strategy}")

xgb_params = {
"tree_method": "approx",
"n_jobs": 2,
"verbosity": 0,
"depth": 3,
Expand Down
7 changes: 6 additions & 1 deletion src/synthcity/utils/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def compress_dataset(
y = df[column]

if len(df[column].unique()) < cat_limit:
model = XGBClassifier()
model = model = XGBClassifier(
tree_method="approx",
n_jobs=2,
verbosity=0,
depth=3,
)
try:
score = evaluate_classifier(model, X, y)["clf"]["aucroc"][0]
except BaseException:
Expand Down
3 changes: 2 additions & 1 deletion tests/metrics/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ def test_detect_synth_timeseries(test_plugin: Plugin, evaluator_t: Type) -> None
assert evaluator.direction() == "minimize"


@pytest.mark.skipif(sys.platform == "linux", reason="Linux only for faster results")
@pytest.mark.skipif(sys.platform != "linux", reason="Linux only for faster results")
@pytest.mark.slow_1
@pytest.mark.slow
def test_image_support_detection() -> None:

dataset = datasets.MNIST(".", download=True)

X1 = ImageDataLoader(dataset).sample(100)
Expand Down

0 comments on commit a856d6b

Please sign in to comment.