Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIR][Docs] Remove BatchPredictor from examples (#37178) #37269

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/source/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ parts:
- file: ray-air/deployment
- file: ray-air/examples/index
sections:
- file: ray-air/examples/opt_deepspeed_batch_inference
- file: ray-air/examples/torch_image_example
- file: ray-air/examples/torch_detection
- file: ray-air/examples/convert_existing_pytorch_code_to_ray_air
Expand Down
14 changes: 0 additions & 14 deletions doc/source/ray-air/doc_code/pytorch_starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,3 @@ def train_func(config):
result = trainer.fit()
print(f"Last result: {result.metrics}")
# __air_pytorch_train_end__


# # __air_pytorch_batchpred_start__
# import random
# from ray.train.batch_predictor import BatchPredictor
# from ray.train.torch import TorchPredictor

# batch_predictor = BatchPredictor.from_checkpoint(result.checkpoint, TorchPredictor)

# items = [{"x": random.uniform(0, 1) for _ in range(10)}]
# prediction_dataset = ray.data.from_items(items)

# predictions = batch_predictor.predict(prediction_dataset, dtype=torch.float)
# # __air_pytorch_batchpred_end__
21 changes: 0 additions & 21 deletions doc/source/ray-air/doc_code/tf_starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,3 @@ def train_func(config: dict):
result = trainer.fit()
print(result.metrics)
# __air_tf_train_end__

# __air_tf_batchpred_start__
import numpy as np

from ray.train.batch_predictor import BatchPredictor
from ray.train.tensorflow import TensorflowPredictor


batch_predictor = BatchPredictor.from_checkpoint(
result.checkpoint, TensorflowPredictor, model_definition=build_model
)

items = [{"x": np.random.uniform(0, 1)} for _ in range(10)]
prediction_dataset = ray.data.from_items(items)

predictions = batch_predictor.predict(prediction_dataset, dtype=tf.float32)

print("PREDICTIONS")
predictions.show()

# __air_tf_batchpred_end__
13 changes: 1 addition & 12 deletions doc/source/ray-air/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,12 @@ filegroup(
py_test_run_all_subdirectory(
size = "medium",
include = ["*.py"],
exclude = ["torch_image_batch_pretrained.py"],
extra_srcs = [],
data = ["//doc/source/ray-air/examples:air_examples"],
tags = ["exclusive", "team:ml", "ray_air"],
)

py_test_run_all_subdirectory(
size = "medium",
include = ["torch_image_batch_pretrained.py"],
exclude = [],
extra_srcs = [],
data = ["//doc/source/ray-air/examples:air_examples"],
tags = ["exclusive", "team:ml", "ray_air", "gpu"],
tags = ["exclusive", "team:ml", "ray_air"],
)


# --------------------------------------------------------------------
# Test all doc/source/ray-air/examples notebooks.
# --------------------------------------------------------------------
Expand All @@ -50,7 +40,6 @@ py_test_run_all_notebooks(
"gptj_serving.ipynb", # Requires GPUs
"stablediffusion_batch_prediction.ipynb", # Requires GPUs
"gptj_deepspeed_fine_tuning.ipynb", # Requires release test
"opt_deepspeed_batch_inference.ipynb", # Requires release test
"dolly_lightning_fsdp_finetuning.ipynb", # Requires release test
],
data = ["//doc/source/ray-air/examples:air_examples"],
Expand Down
Loading