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

Can p12 01 #45726

Merged
merged 2 commits into from
Jun 24, 2024
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
4 changes: 4 additions & 0 deletions .buildkite/_forge.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
cuda:
- "11.7.1-cudnn8"
- "11.8.0-cudnn8"
Expand All @@ -41,6 +42,7 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
env:
PYTHON_VERSION: "{{matrix}}"

Expand All @@ -57,6 +59,7 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
cuda:
- "11.8.0-cudnn8"
env:
Expand All @@ -74,5 +77,6 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
env:
PYTHON_VERSION: "{{matrix}}"
2 changes: 2 additions & 0 deletions .buildkite/build.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"

- label: ":tapioca: build: ray-ml py{{matrix}} docker (x86_64)"
tags:
Expand All @@ -90,3 +91,4 @@ steps:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
4 changes: 3 additions & 1 deletion bazel/python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ def py_test_run_all_subdirectory(include, exclude, extra_srcs, **kwargs):
basename = paths.split_extension(file)[0]
if basename == file:
basename = basename + "_test"
if file not in extra_srcs:
extra_srcs = extra_srcs + [file]
native.py_test(
name = basename,
srcs = extra_srcs + [file],
srcs = extra_srcs,
**kwargs
)

Expand Down
2 changes: 1 addition & 1 deletion ci/docker/ml.build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN <<EOF
set -euo pipefail

DOC_TESTING=1 TRAIN_TESTING=1 TUNE_TESTING=1 DATA_PROCESSING_TESTING=1 \
INSTALL_HOROVOD=1 INSTALL_HDFS=1 \
INSTALL_HDFS=1 \
./ci/env/install-dependencies.sh

if [[ "$RAYCI_IS_GPU_BUILD" == "true" ]]; then
Expand Down
12 changes: 6 additions & 6 deletions ci/env/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,12 @@ install_pip_packages() {
download_mnist
fi

if [ "${DOC_TESTING-}" = 1 ]; then
# Todo: This downgrades spacy and related dependencies because
# `en_core_web_sm` is only compatible with spacy < 3.6.
# We should move to a model that does not depend on a stale version.
python -m spacy download en_core_web_sm
fi
# if [ "${DOC_TESTING-}" = 1 ]; then
# # Todo: This downgrades spacy and related dependencies because
# # `en_core_web_sm` is only compatible with spacy < 3.6.
# # We should move to a model that does not depend on a stale version.
# python -m spacy download en_core_web_sm
# fi
}

install_thirdparty_packages() {
Expand Down
5 changes: 4 additions & 1 deletion dashboard/modules/job/tests/test_http_job_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,10 @@ def test_http_bad_request(job_sdk_client):
)

assert r.status_code == 400
assert "TypeError: __init__() got an unexpected keyword argument" in r.text
assert (
"TypeError: JobSubmitRequest.__init__() got an unexpected keyword argument"
in r.text
)


def test_invalid_runtime_env(job_sdk_client):
Expand Down
2 changes: 1 addition & 1 deletion dashboard/modules/reporter/tests/test_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import psutil
import ray
from mock import patch
from unittest.mock import patch
from ray._private import ray_constants
from ray._private.metrics_agent import fix_grpc_metric
from ray._private.test_utils import (
Expand Down
8 changes: 7 additions & 1 deletion doc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ py_test_run_all_subdirectory(
"source/serve/doc_code/http_guide/websockets_example.py",
"source/serve/doc_code/vllm_example.py",
],
extra_srcs = [],
extra_srcs = [
"source/serve/doc_code/faker.py",
"source/serve/doc_code/translator_example.py",
"source/serve/doc_code/test_service_pb2_grpc.py",
"source/serve/doc_code/grpc_proxy/user_defined_protos_pb2.py",
"source/serve/doc_code/grpc_proxy/user_defined_protos_pb2_grpc.py",
],
tags = ["exclusive", "team:serve"],
)

Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/fake_email_creator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# __fake_start__
from faker import Faker
from doc.source.serve.doc_code.faker import Faker

from ray import serve

Expand Down
60 changes: 43 additions & 17 deletions doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

grpc_port = 9000
grpc_servicer_functions = [
"user_defined_protos_pb2_grpc.add_UserDefinedServiceServicer_to_server",
"user_defined_protos_pb2_grpc.add_ImageClassificationServiceServicer_to_server",
"doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc.add_UserDefinedServiceServicer_to_server",
"doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc.add_ImageClassificationServiceServicer_to_server",
]
serve.start(
grpc_options=gRPCOptions(
Expand All @@ -26,8 +26,9 @@
# __begin_grpc_deployment__
import time


from typing import Generator
from user_defined_protos_pb2 import (
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
UserDefinedMessage2,
UserDefinedResponse,
Expand Down Expand Up @@ -90,8 +91,12 @@ def Streaming(

# __begin_send_grpc_requests__
import grpc
from user_defined_protos_pb2_grpc import UserDefinedServiceStub
from user_defined_protos_pb2 import UserDefinedMessage
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
UserDefinedServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
)


channel = grpc.insecure_channel("localhost:9000")
Expand Down Expand Up @@ -125,8 +130,12 @@ def Streaming(

# __begin_metadata__
import grpc
from user_defined_protos_pb2_grpc import UserDefinedServiceStub
from user_defined_protos_pb2 import UserDefinedMessage2
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
UserDefinedServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage2,
)


channel = grpc.insecure_channel("localhost:9000")
Expand All @@ -150,8 +159,12 @@ def Streaming(

# __begin_streaming__
import grpc
from user_defined_protos_pb2_grpc import UserDefinedServiceStub
from user_defined_protos_pb2 import UserDefinedMessage
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
UserDefinedServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
)


channel = grpc.insecure_channel("localhost:9000")
Expand All @@ -173,7 +186,7 @@ def Streaming(
from PIL import Image
from io import BytesIO
from torchvision import transforms
from user_defined_protos_pb2 import (
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
ImageClass,
ImageData,
)
Expand Down Expand Up @@ -277,8 +290,10 @@ def __call__(self, image: Image):

# __begin_model_composition_client__
import grpc
from user_defined_protos_pb2_grpc import ImageClassificationServiceStub
from user_defined_protos_pb2 import ImageData
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
ImageClassificationServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import ImageData


channel = grpc.insecure_channel("localhost:9000")
Expand All @@ -295,8 +310,12 @@ def __call__(self, image: Image):

# __begin_error_handle__
import grpc
from user_defined_protos_pb2_grpc import UserDefinedServiceStub
from user_defined_protos_pb2 import UserDefinedMessage
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
UserDefinedServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
)


channel = grpc.insecure_channel("localhost:9000")
Expand All @@ -312,7 +331,10 @@ def __call__(self, image: Image):


# __begin_grpc_context_define_app__
from user_defined_protos_pb2 import UserDefinedMessage, UserDefinedResponse
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
UserDefinedResponse,
)

from ray import serve
from ray.serve.grpc_util import RayServegRPCContext
Expand Down Expand Up @@ -364,8 +386,12 @@ def __call__(

# __begin_grpc_context_client__
import grpc
from user_defined_protos_pb2_grpc import UserDefinedServiceStub
from user_defined_protos_pb2 import UserDefinedMessage
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2_grpc import (
UserDefinedServiceStub,
)
from doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 import (
UserDefinedMessage,
)


channel = grpc.insecure_channel("localhost:9000")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

import user_defined_protos_pb2 as user__defined__protos__pb2
import doc.source.serve.doc_code.grpc_proxy.user_defined_protos_pb2 as user__defined__protos__pb2 # noqa: E501


class UserDefinedServiceStub(object):
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/image_classifier_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def __call__(self, req: starlette.requests.Request):
# __request_end__
assert resp.text == "brown bear, bruin, Ursus arctos"

from translator_example import app as translator_app # noqa
from doc.source.serve.doc_code.translator_example import app as translator_app # noqa

serve.run(
ModifiedImageClassifier.bind(downloader.bind()),
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/test_service_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

import test_service_pb2 as src_dot_ray_dot_protobuf_dot_test__service__pb2
import doc.source.serve.doc_code.test_service_pb2 as src_dot_ray_dot_protobuf_dot_test__service__pb2


class TestServiceStub(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# isort: skip_file
from lightning_exp_tracking_model_dl import DummyModel, dataloader
from ray.train.examples.experiment_tracking.lightning_exp_tracking_model_dl import (
DummyModel,
dataloader,
)

# __lightning_experiment_tracking_comet_start__
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
tempdir = tempfile.TemporaryDirectory()
os.environ["SHARED_STORAGE_PATH"] = tempdir.name

from lightning_exp_tracking_model_dl import DummyModel, dataloader
from ray.train.examples.experiment_tracking.lightning_exp_tracking_model_dl import (
DummyModel,
dataloader,
)

# __lightning_experiment_tracking_mlflow_start__
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
tempdir = tempfile.TemporaryDirectory()
os.environ["SHARED_STORAGE_PATH"] = tempdir.name

from lightning_exp_tracking_model_dl import DummyModel, dataloader
from ray.train.examples.experiment_tracking.lightning_exp_tracking_model_dl import (
DummyModel,
dataloader,
)

# __lightning_experiment_tracking_tensorboard_start__
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# fmt: off
# # isort: skip_file

from lightning_exp_tracking_model_dl import DummyModel, dataloader
from ray.train.examples.experiment_tracking.lightning_exp_tracking_model_dl import DummyModel, dataloader

# __lightning_experiment_tracking_wandb_start__
import os
Expand Down
17 changes: 9 additions & 8 deletions python/ray/train/examples/tf/tensorflow_regression_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse

import keras
import tensorflow as tf

import ray
Expand All @@ -10,12 +11,12 @@
from ray.train.tensorflow import TensorflowTrainer


def build_model() -> tf.keras.Model:
model = tf.keras.Sequential(
def build_model() -> keras.Model:
model = keras.Sequential(
[
tf.keras.layers.InputLayer(input_shape=(100,)),
tf.keras.layers.Dense(10),
tf.keras.layers.Dense(1),
keras.layers.InputLayer(input_shape=(100,)),
keras.layers.Dense(10),
keras.layers.Dense(1),
]
)
return model
Expand All @@ -30,9 +31,9 @@ def train_func(config: dict):
# Model building/compiling need to be within `strategy.scope()`.
multi_worker_model = build_model()
multi_worker_model.compile(
optimizer=tf.keras.optimizers.SGD(learning_rate=config.get("lr", 1e-3)),
loss=tf.keras.losses.mean_absolute_error,
metrics=[tf.keras.metrics.mean_squared_error],
optimizer=keras.optimizers.SGD(learning_rate=config.get("lr", 1e-3)),
loss=keras.losses.mean_absolute_error,
metrics=[keras.metrics.mean_squared_error],
)

dataset = train.get_dataset_shard("train")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from common import (
from filelock import FileLock

import ray
from ray import train, tune
from ray.tune.examples.pbt_dcgan_mnist.common import (
MODEL_PATH,
Discriminator,
Generator,
Expand All @@ -25,10 +29,6 @@
train_func,
weights_init,
)
from filelock import FileLock

import ray
from ray import train, tune
from ray.tune.schedulers import PopulationBasedTraining


Expand Down
Loading
Loading