Skip to content

Commit d763e7b

Browse files
Update FIL tests to run on CPU as well as GPU (#356)
* Remove skip of tests in test_forest.py on CPU * Remove GPU-only restriction from FIL op tests
1 parent 5fd8277 commit d763e7b

File tree

4 files changed

+0
-20
lines changed

4 files changed

+0
-20
lines changed

tests/unit/systems/dag/runtimes/triton/ops/fil/test_xgboost_triton.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pandas as pd
55
import pytest
66

7-
from merlin.core.compat import HAS_GPU
87
from merlin.dag import ColumnSelector
98
from merlin.schema import ColumnSchema, Schema
109
from merlin.systems.dag.ensemble import Ensemble
@@ -27,7 +26,6 @@
2726
(TritonExecutorRuntime(), None, "executor_model"),
2827
],
2928
)
30-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
3129
def test_xgboost_regressor_forest_inference(runtime, model_name, expected_model_name, tmpdir):
3230
rows = 200
3331
num_features = 16
@@ -66,7 +64,6 @@ def test_xgboost_regressor_forest_inference(runtime, model_name, expected_model_
6664

6765

6866
@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
69-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
7067
@pytest.mark.parametrize(
7168
["runtime", "model_name", "expected_model_name"],
7269
[

tests/unit/systems/ops/fil/test_ensemble.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sklearn.datasets
2222
import xgboost
2323

24-
from merlin.core.compat import HAS_GPU
2524
from merlin.dag import ColumnSelector
2625
from merlin.io import Dataset
2726
from merlin.schema import ColumnSchema, Schema
@@ -40,7 +39,6 @@
4039

4140

4241
@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
43-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
4442
def test_workflow_with_forest_inference(tmpdir):
4543
rows = 200
4644
num_features = 16

tests/unit/systems/ops/fil/test_forest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from google.protobuf import text_format
2323
from tritonclient.grpc import model_config_pb2 as model_config
2424

25-
from merlin.core.compat import HAS_GPU
2625
from merlin.core.utils import Distributed
2726
from merlin.dag import ColumnSelector
2827
from merlin.io import Dataset
@@ -42,7 +41,6 @@ def read_config(config_path):
4241
return text_format.Parse(raw_config, config)
4342

4443

45-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
4644
def test_export(tmpdir):
4745
rows = 200
4846
num_features = 16
@@ -67,7 +65,6 @@ def test_export(tmpdir):
6765
assert parsed_config.backend == "fil"
6866

6967

70-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
7168
def test_export_merlin_models(tmpdir):
7269
merlin_xgb = pytest.importorskip("merlin.models.xgb")
7370

@@ -104,7 +101,6 @@ def test_export_merlin_models(tmpdir):
104101
assert parsed_config.backend == "fil"
105102

106103

107-
@pytest.mark.skipif(not HAS_GPU, reason="no gpu detected")
108104
def test_ensemble(tmpdir):
109105
rows = 200
110106
num_features = 16

tests/unit/systems/ops/fil/test_op.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@
2525
from tritonclient.grpc import model_config_pb2 as model_config # noqa
2626

2727
import merlin.systems.dag.ops.fil as fil_op
28-
from merlin.core.compat import HAS_GPU
2928
from merlin.dag import ColumnSelector, Graph
3029
from merlin.schema import Schema
3130
from merlin.systems.dag.runtimes.triton.ops.fil import FILTriton
3231

33-
need_gpu = pytest.mark.skipif(not HAS_GPU, reason="No GPU available")
34-
3532

3633
def export_op(export_dir, triton_op) -> model_config.ModelConfig:
3734
triton_op.export(export_dir, None, None)
@@ -150,7 +147,6 @@ def test_binary_classifier_default_cpu(get_model_fn, get_model_params, tmpdir):
150147
["get_model_fn", "get_model_params"],
151148
[(xgboost_train, {"objective": "binary:logistic"}), (xgboost_classifier, {})],
152149
)
153-
@need_gpu
154150
def test_binary_classifier_default_gpu(get_model_fn, get_model_params, tmpdir):
155151
X, y = get_classification_data(classes=2)
156152
model = get_model_fn(X, y, **get_model_params)
@@ -165,7 +161,6 @@ def test_binary_classifier_default_gpu(get_model_fn, get_model_params, tmpdir):
165161
["get_model_fn", "get_model_params"],
166162
[(xgboost_train, {"objective": "binary:logistic"}), (xgboost_classifier, {})],
167163
)
168-
@need_gpu
169164
def test_binary_classifier_with_proba_gpu(get_model_fn, get_model_params, tmpdir):
170165
X, y = get_classification_data(classes=2)
171166
model = get_model_fn(X, y, **get_model_params)
@@ -198,7 +193,6 @@ def test_binary_classifier_with_proba_cpu(get_model_fn, get_model_params, tmpdir
198193
["get_model_fn", "get_model_params"],
199194
[(xgboost_train, {"objective": "multi:softmax", "num_class": 8}), (xgboost_classifier, {})],
200195
)
201-
@need_gpu
202196
def test_multi_classifier_gpu(get_model_fn, get_model_params, tmpdir):
203197
X, y = get_classification_data(classes=8)
204198
model = get_model_fn(X, y, **get_model_params)
@@ -231,7 +225,6 @@ def test_multi_classifier_cpu(get_model_fn, get_model_params, tmpdir):
231225
["get_model_fn", "get_model_params"],
232226
[(xgboost_train, {"objective": "reg:squarederror"}), (xgboost_regressor, {})],
233227
)
234-
@need_gpu
235228
def test_regressor_gpu(get_model_fn, get_model_params, tmpdir):
236229
X, y = get_regression_data()
237230
model = get_model_fn(X, y, **get_model_params)
@@ -266,7 +259,6 @@ def test_regressor_cpu(get_model_fn, get_model_params, tmpdir):
266259
(xgboost_regressor, "xgboost.json"),
267260
],
268261
)
269-
@need_gpu
270262
def test_model_file_gpu(get_model_fn, expected_model_filename, tmpdir):
271263
X, y = get_regression_data()
272264
model = get_model_fn(X, y)
@@ -292,7 +284,6 @@ def test_model_file_cpu(get_model_fn, expected_model_filename, tmpdir):
292284
assert model_path.is_file()
293285

294286

295-
@need_gpu
296287
def test_fil_op_exports_own_config(tmpdir):
297288
X, y = get_regression_data()
298289
model = xgboost_train(X, y, objective="reg:squarederror")
@@ -309,7 +300,6 @@ def test_fil_op_exports_own_config(tmpdir):
309300
assert config.output[0].dims == [1]
310301

311302

312-
@need_gpu
313303
def test_fil_op_compute_schema():
314304
X, y = get_regression_data()
315305
model = xgboost_train(X, y, objective="reg:squarederror")
@@ -323,7 +313,6 @@ def test_fil_op_compute_schema():
323313
assert out_schema.column_names == ["output__0"]
324314

325315

326-
@need_gpu
327316
def test_fil_schema_validation():
328317
X, y = get_regression_data()
329318
model = xgboost_train(X, y, objective="reg:squarederror")

0 commit comments

Comments
 (0)