Skip to content

Commit ab784fb

Browse files
authored
[train] Migrate/disable a few remaining tests for V2 (#57764)
There's a few more tests that haven't been migrated -- this PR migrates them as preparation to flip the V2 switch. --------- Signed-off-by: Justin Yu <justinvyu@anyscale.com>
1 parent d34e68b commit ab784fb

File tree

16 files changed

+46
-2316
lines changed

16 files changed

+46
-2316
lines changed

ci/ray_ci/doc/cmd_check_api_discrepancy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"ray.train.error.SessionMisuseError",
6464
"ray.train.TrainingFailedError",
6565
"ray.train.context.TrainContext",
66+
"ray.train.context.get_context",
6667
},
6768
},
6869
"tune": {

doc/BUILD.bazel

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ py_test_run_all_subdirectory(
416416

417417
py_test_run_all_subdirectory(
418418
size = "large",
419+
env = {"RAY_TRAIN_V2_ENABLED": "1"},
419420
include = ["source/train/doc_code/*.py"],
420421
exclude = [
421422
"source/train/doc_code/hvd_trainer.py", # CI do not have Horovod
@@ -485,17 +486,17 @@ py_test(
485486
# Test all doc/external code
486487
# --------------------------------------------------------------------
487488

488-
py_test_run_all_subdirectory(
489-
size = "enormous",
490-
include = ["external/*.py"],
491-
exclude = ["external/test_hashes.py"],
492-
extra_srcs = [],
493-
tags = [
494-
"exclusive",
495-
"external",
496-
"team:ml",
497-
],
498-
)
489+
# py_test_run_all_subdirectory(
490+
# size = "enormous",
491+
# include = ["external/*.py"],
492+
# exclude = ["external/test_hashes.py"],
493+
# extra_srcs = [],
494+
# tags = [
495+
# "exclusive",
496+
# "external",
497+
# "team:ml",
498+
# ],
499+
# )
499500

500501
py_test(
501502
name = "test_external_hashes",
@@ -643,6 +644,8 @@ doctest(
643644

644645
doctest(
645646
name = "doctest[train]",
647+
# TODO: [V2] Migrate
648+
env = {"RAY_TRAIN_V2_ENABLED": "0"},
646649
files = glob(
647650
include = [
648651
"source/train/**/*.md",
@@ -665,6 +668,8 @@ doctest(
665668
"source/train/user-guides/data-loading-preprocessing.rst",
666669
"source/train/user-guides/using-gpus.rst",
667670
],
671+
# TODO: [V2] Migrate
672+
env = {"RAY_TRAIN_V2_ENABLED": "0"},
668673
tags = ["team:ml"],
669674
gpu = True,
670675
)

doc/source/rllib/getting-started.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ one for each of the configured learning rates:
210210

211211
.. testcode::
212212

213-
from ray import train, tune
213+
from ray import tune
214214
from ray.rllib.algorithms.ppo import PPOConfig
215215

216216
config = (
@@ -230,7 +230,7 @@ one for each of the configured learning rates:
230230
# pretty printed result metrics from the results returned previously by
231231
# ``.train()``. Also note that -1100 is not a good episode return for
232232
# Pendulum-v1, we are using it here to shorten the experiment time.
233-
run_config=train.RunConfig(
233+
run_config=tune.RunConfig(
234234
stop={"env_runners/episode_return_mean": -1100.0},
235235
),
236236
)

doc/source/train/distributed-tensorflow-keras.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,6 @@ Load checkpoints
339339
result = trainer.fit()
340340
print(result.checkpoint)
341341

342-
# Start a new run from a loaded checkpoint
343-
trainer = TensorflowTrainer(
344-
train_func,
345-
train_loop_config={"num_epochs": 5},
346-
scaling_config=ScalingConfig(num_workers=2),
347-
resume_from_checkpoint=result.checkpoint,
348-
)
349-
result = trainer.fit()
350-
351342

352343
Further reading
353344
---------------

doc/source/train/doc_code/dl_guide.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# flake8: noqa
22

3+
# TODO: [V2] Deprecated doc code to delete.
4+
import os
5+
6+
os.environ["RAY_TRAIN_V2_ENABLED"] = "0"
7+
38
MOCK = True
49

510
# __ft_initial_run_start__

doc/source/train/doc_code/hvd_trainer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
# TODO: [V2] Deprecated doc code to delete.
12
import os
3+
4+
os.environ["RAY_TRAIN_V2_ENABLED"] = "0"
5+
26
import tempfile
37

48
import horovod.torch as hvd

doc/source/train/doc_code/key_concepts.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from ray import train
88
from ray.train import Checkpoint
9-
from ray.train.data_parallel_trainer import DataParallelTrainer
9+
from ray.train.v2.api.data_parallel_trainer import DataParallelTrainer
1010

1111

1212
def train_fn(config):
@@ -34,8 +34,6 @@ def train_fn(config):
3434
# The experiment results will be saved to: storage_path/name
3535
storage_path=os.path.expanduser("~/ray_results"),
3636
# storage_path="s3://my_bucket/tune_results",
37-
# Stopping criteria
38-
stop={"training_iteration": 10},
3937
)
4038
# __run_config_end__
4139

doc/source/train/doc_code/tuner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# flake8: noqa
22
# isort: skip_file
33

4+
# TODO: [V2] Deprecated doc code to delete.
5+
import os
6+
7+
os.environ["RAY_TRAIN_V2_ENABLED"] = "0"
8+
49
# __basic_start__
510
import ray
611
import ray.tune

doc/source/train/examples/lightgbm/BUILD.bazel

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

0 commit comments

Comments
 (0)