Skip to content

Commit

Permalink
use a jit-disable plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jan 2, 2019
1 parent 99b24b8 commit cfa4856
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
displayName: 'Test LKPY'
- script: |
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval --no-slow --verbose
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval
displayName: 'Test Coverage'
- script: |
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
displayName: 'pytest'
- script: |
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval --no-slow --verbose
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval
displayName: 'Test Coverage'
- script: |
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
displayName: 'pytest'
- script: |
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval --no-slow --verbose
env NUMBA_DISABLE_JIT=1 invoke test --cover --no-eval
displayName: 'Test Coverage'
- script: |
Expand Down
4 changes: 4 additions & 0 deletions tests/lk_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def ml_sample():
ml100k = _ML100K()


wantjit = pytest.mark.skipif('NUMBA_DISABLE_JIT' in os.environ,
reason='JIT required')


@contextmanager
def envvars(**vars):
save = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_als_explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_als_predict_bad_user():
assert np.isnan(preds.loc[3])


@mark.slow
@lktu.wantjit
def test_als_train_large():
algo = als.BiasedMF(20, iterations=10)
ratings = lktu.ml_pandas.renamed.ratings
Expand Down
4 changes: 2 additions & 2 deletions tests/test_als_implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_als_predict_bad_user():
assert np.isnan(preds.loc[3])


@mark.slow
@lktu.wantjit
def test_als_train_large():
algo = als.ImplicitMF(20, iterations=20)
ratings = lktu.ml_pandas.renamed.ratings
Expand Down Expand Up @@ -88,7 +88,7 @@ def test_als_save_load(tmp_path):
assert np.all(restored.user_index_ == algo.user_index_)


@mark.slow
@lktu.wantjit
def test_als_train_large_noratings():
algo = als.ImplicitMF(20, iterations=20)
ratings = lktu.ml_pandas.renamed.ratings
Expand Down
2 changes: 1 addition & 1 deletion tests/test_batch_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_sweep_persist(tmp_path):
sweep.add_datasets(lambda: xf.partition_users(ratings, 5, xf.SampleN(5)), name='ml-small')
sweep.persist_data()

for i in range(1,6):
for i in range(1, 6):
assert (work / 'ds{}-train.parquet'.format(i)).exists()
assert (work / 'ds{}-test.parquet'.format(i)).exists()

Expand Down
3 changes: 3 additions & 0 deletions tests/test_funksvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_fsvd_predict_bad_user():
assert np.isnan(preds.loc[3])


@lktu.wantjit
@mark.slow
def test_fsvd_save_load(tmp_path):
tmp_path = lktu.norm_path(tmp_path)
Expand Down Expand Up @@ -151,6 +152,7 @@ def test_fsvd_save_load(tmp_path):
assert np.all(algo.user_index_ == original.user_index_)


@lktu.wantjit
@mark.slow
def test_fsvd_known_preds():
algo = svd.FunkSVD(15, iterations=125, lrate=0.001)
Expand Down Expand Up @@ -178,6 +180,7 @@ def test_fsvd_known_preds():
raise e


@lktu.wantjit
@mark.slow
@mark.eval
@mark.skipif(not lktu.ml100k.available, reason='ML100K data not present')
Expand Down
13 changes: 8 additions & 5 deletions tests/test_knn_item_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_ii_simple_implicit_predict():
assert res.loc[6] > 0


@mark.slow
@lktu.wantjit
@mark.skip("redundant with large_models")
def test_ii_train_big():
"Simple tests for bounded models"
Expand All @@ -132,7 +132,7 @@ def test_ii_train_big():
assert means[algo.item_index_].values == approx(algo.item_means_)


@mark.slow
@lktu.wantjit
@mark.skip("redundant with large_models")
def test_ii_train_big_unbounded():
"Simple tests for unbounded models"
Expand All @@ -150,7 +150,7 @@ def test_ii_train_big_unbounded():
assert means[algo.item_index_].values == approx(algo.item_means_)


@mark.slow
@lktu.wantjit
@mark.skipif(not lktu.ml100k.available, reason='ML100K data not present')
def test_ii_train_ml100k(tmp_path):
"Test an unbounded model on ML-100K"
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_ii_train_ml100k(tmp_path):
assert all(r_mat.values[sp:ep] == o_mat.values[sp:ep])


@mark.slow
@lktu.wantjit
def test_ii_large_models():
"Several tests of large trained I-I models"
_log.info('training limited model')
Expand Down Expand Up @@ -291,6 +291,7 @@ def test_ii_large_models():
assert all(ubs_except_min.index.isin(b_nbrs.index))


@lktu.wantjit
def test_ii_save_load(tmp_path):
"Save and load a model"
tmp_path = lktu.norm_path(tmp_path)
Expand Down Expand Up @@ -404,6 +405,7 @@ def test_ii_implicit_save_load(tmp_path):
assert all(np.diff(row.data) < 1.0e-6)


@lktu.wantjit
@mark.slow
def test_ii_implicit():
algo = knn.ItemItem(20, save_nbrs=100, center=False, aggregate='sum')
Expand Down Expand Up @@ -448,7 +450,7 @@ def eval(train, test):
assert user_rmse.mean() == approx(0.90, abs=0.05)


@mark.slow
@lktu.wantjit
def test_ii_known_preds():
from lenskit import batch

Expand Down Expand Up @@ -480,6 +482,7 @@ def test_ii_known_preds():
raise e


@lktu.wantjit
@mark.slow
@mark.eval
@mark.parametrize('ncpus', [1, 2])
Expand Down

0 comments on commit cfa4856

Please sign in to comment.