Skip to content

Commit 5960685

Browse files
justinvyuAydin-ab
authored andcommitted
[train] Port over remaining tests to Train v2 (ray-project#57722)
Ports over the remaining unit tests that were marked as TODOs from this series of PRs: ray-project#57534, ray-project#57256, ray-project#56868, ray-project#56820, ray-project#56816. Notably: * `test_new_dataset_config -> test_data_integration` * `test_backend -> test_torch_trainer, test_worker_group` * `test_gpu -> test_torch_gpu` This PR also finishes migrating the Tune LightGBM/Keras examples which were unblocked by ray-project#57042 and ray-project#57121. --------- Signed-off-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: Aydin Abiar <aydin@anyscale.com>
1 parent 5871494 commit 5960685

34 files changed

+479
-2649
lines changed

doc/source/train/examples/pytorch/tune_cifar_torch_pbt_example.rst

Lines changed: 0 additions & 15 deletions
This file was deleted.

doc/source/tune/examples/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ py_test_run_all_notebooks(
2020
exclude = [
2121
"pbt_ppo_example.ipynb",
2222
"tune-xgboost.ipynb",
23-
"lightgbm_example.ipynb", # TODO: [V2] Remove after fixing Tune lightgbm callback.
24-
"tune_mnist_keras.ipynb", # TODO: [V2] Remove after fixing Tune keras callback.
2523
"pbt_transformers.ipynb", # Transformers uses legacy Tune APIs.
2624
"tune-aim.ipynb", # CI does not have `aim`
2725
"bohb_example.ipynb", # CI does not have bohb requirements

doc/source/tune/examples/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ Ray Tune integrates with many popular machine learning frameworks. Here you find
4444
* - :doc:`Tuning XGBoost parameters with Tune <tune-xgboost>`
4545
* - :doc:`Tuning LightGBM parameters with Tune <lightgbm_example>`
4646
* - :doc:`Tuning Hugging Face Transformers with Tune <pbt_transformers>`
47-
* - :doc:`End-to-end example for tuning a PyTorch model with PBT <../../train/examples/pytorch/tune_cifar_torch_pbt_example>`
4847

4948
.. _experiment-tracking-tools:
5049

doc/source/tune/examples/tune_mnist_keras.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 3,
39+
"execution_count": null,
4040
"id": "19e3c389",
4141
"metadata": {
4242
"tags": [
@@ -150,7 +150,7 @@
150150
"\n",
151151
"from ray import tune\n",
152152
"from ray.tune.schedulers import AsyncHyperBandScheduler\n",
153-
"from ray.air.integrations.keras import ReportCheckpointCallback\n",
153+
"from ray.tune.integration.keras import TuneReportCheckpointCallback\n",
154154
"\n",
155155
"\n",
156156
"def train_mnist(config):\n",
@@ -186,7 +186,7 @@
186186
" epochs=epochs,\n",
187187
" verbose=0,\n",
188188
" validation_data=(x_test, y_test),\n",
189-
" callbacks=[ReportCheckpointCallback(metrics={\"accuracy\": \"accuracy\"})],\n",
189+
" callbacks=[TuneReportCheckpointCallback(metrics={\"accuracy\": \"accuracy\"})],\n",
190190
" )\n",
191191
"\n",
192192
"\n",

python/ray/air/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ py_test(
4343
name = "test_new_dataset_config",
4444
size = "large",
4545
srcs = ["tests/test_new_dataset_config.py"],
46-
# TODO: Move over
46+
# NOTE: Relevant tests moved to train/v2/tests/test_data_integration.py
4747
env = {"RAY_TRAIN_V2_ENABLED": "0"},
4848
tags = [
4949
"exclusive",

python/ray/train/BUILD.bazel

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,6 @@ py_test(
181181
deps = [":train_lib"],
182182
)
183183

184-
# TODO: Delete this together with the long running PBT release test.
185-
py_test(
186-
name = "tune_cifar_torch_pbt_example",
187-
size = "medium",
188-
srcs = ["examples/pytorch/tune_cifar_torch_pbt_example.py"],
189-
args = ["--smoke-test"],
190-
env = {"RAY_TRAIN_V2_ENABLED": "0"},
191-
main = "examples/pytorch/tune_cifar_torch_pbt_example.py",
192-
tags = [
193-
"exclusive",
194-
"pytorch",
195-
"team:ml",
196-
"tune",
197-
],
198-
deps = [":train_lib"],
199-
)
200-
201184
# Formerly AIR examples
202185

203186
py_test(
@@ -362,7 +345,9 @@ py_test(
362345
name = "test_backend",
363346
size = "large",
364347
srcs = ["tests/test_backend.py"],
365-
# TODO: should port over
348+
# NOTE: Relevant tests have been migrated to
349+
# test_torch_trainer.py and test_worker_group.py
350+
# TODO: [V2] There are still some accelerator integration tests left.
366351
env = {"RAY_TRAIN_V2_ENABLED": "0"},
367352
tags = [
368353
"exclusive",
@@ -466,7 +451,7 @@ py_test(
466451
name = "test_gpu",
467452
size = "large",
468453
srcs = ["tests/test_gpu.py"],
469-
# TODO: move over, rename to test_torch_gpu_utils
454+
# NOTE: Migrated relevant tests to v2/tests/test_torch_gpu.py
470455
env = {"RAY_TRAIN_V2_ENABLED": "0"},
471456
tags = [
472457
"exclusive",
@@ -602,13 +587,12 @@ py_test(
602587
name = "test_torch_lightning_train",
603588
size = "large",
604589
srcs = ["tests/test_torch_lightning_train.py"],
605-
# TODO: move over
606-
env = {"RAY_TRAIN_V2_ENABLED": "0"},
590+
env = {"RAY_TRAIN_V2_ENABLED": "1"},
607591
tags = [
608592
"exclusive",
609-
"gpu",
610593
"ptl_v2",
611594
"team:ml",
595+
"train_v2_gpu",
612596
],
613597
deps = [":train_lib"],
614598
)
@@ -683,7 +667,8 @@ py_test(
683667
name = "test_minimal",
684668
size = "small",
685669
srcs = ["tests/test_minimal.py"],
686-
# TODO: move over
670+
# TODO: [V2] The minimal test needs to install pydantic,
671+
# which is a Train V2 dependency.
687672
env = {"RAY_TRAIN_V2_ENABLED": "0"},
688673
tags = [
689674
"exclusive",

python/ray/train/examples/pytorch/tune_cifar_torch_pbt_example.py

Lines changed: 0 additions & 253 deletions
This file was deleted.

0 commit comments

Comments
 (0)