Skip to content

Commit 71c6f3c

Browse files
speedstorm1copybara-github
authored andcommitted
feat: update setup.py for including Ray v2.33, restrict RoV prediction to 2.9.3 for now
PiperOrigin-RevId: 673086035
1 parent 6cc5fa2 commit 71c6f3c

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

google/cloud/aiplatform/vertex_ray/predict/sklearn/register.py

+14
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ def register_sklearn(
8686
8787
Raises:
8888
ValueError: Invalid Argument.
89+
RuntimeError: Only Ray version 2.9.3 is supported.
8990
"""
91+
ray_version = ray.__version__
92+
if ray_version != "2.9.3":
93+
raise RuntimeError(
94+
f"Ray version {ray_version} is not supported to upload Sklearn"
95+
" model to Vertex Model Registry yet. Please use Ray 2.9.3."
96+
)
97+
9098
artifact_uri = artifact_uri or initializer.global_config.staging_bucket
9199
predict_utils.validate_artifact_uri(artifact_uri)
92100
display_model_name = (
@@ -122,11 +130,17 @@ def _get_estimator_from(
122130
ValueError: Invalid Argument.
123131
RuntimeError: Model not found.
124132
RuntimeError: Ray version 2.4 is not supported.
133+
RuntimeError: Only Ray version 2.9.3 is supported.
125134
"""
126135

127136
ray_version = ray.__version__
128137
if ray_version == "2.4.0":
129138
raise RuntimeError(_V2_4_WARNING_MESSAGE)
139+
if ray_version != "2.9.3":
140+
raise RuntimeError(
141+
f"Ray version {ray_version} is not supported to convert a Sklearn"
142+
" checkpoint to sklearn estimator on Vertex yet. Please use Ray 2.9.3."
143+
)
130144

131145
try:
132146
return checkpoint.get_model()

google/cloud/aiplatform/vertex_ray/predict/torch/register.py

+6
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ def get_pytorch_model_from(
6161
ModuleNotFoundError: PyTorch isn't installed.
6262
RuntimeError: Model not found.
6363
RuntimeError: Ray version 2.4 is not supported.
64+
RuntimeError: Only Ray version 2.9.3 is supported.
6465
"""
6566
ray_version = ray.__version__
6667
if ray_version == "2.4.0":
6768
raise RuntimeError(_V2_4_WARNING_MESSAGE)
69+
if ray_version != "2.9.3":
70+
raise RuntimeError(
71+
f"Ray on Vertex does not support Ray version {ray_version} to"
72+
" convert PyTorch model artifacts yet. Please use Ray 2.9.3."
73+
)
6874

6975
try:
7076
return checkpoint.get_model()

google/cloud/aiplatform/vertex_ray/predict/xgboost/register.py

+14
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,15 @@ def register_xgboost(
9494
9595
Raises:
9696
ValueError: Invalid Argument.
97+
RuntimeError: Only Ray version 2.9.3 is supported.
9798
"""
99+
ray_version = ray.__version__
100+
if ray_version != "2.9.3":
101+
raise RuntimeError(
102+
f"Ray version {ray_version} is not supported to upload XGBoost"
103+
" model to Vertex Model Registry yet. Please use Ray 2.9.3."
104+
)
105+
98106
artifact_uri = artifact_uri or initializer.global_config.staging_bucket
99107
predict_utils.validate_artifact_uri(artifact_uri)
100108
display_model_name = (
@@ -136,10 +144,16 @@ def _get_xgboost_model_from(
136144
ModuleNotFoundError: XGBoost isn't installed.
137145
RuntimeError: Model not found.
138146
RuntimeError: Ray version 2.4 is not supported.
147+
RuntimeError: Only Ray version 2.9.3 is supported.
139148
"""
140149
ray_version = ray.__version__
141150
if ray_version == "2.4.0":
142151
raise RuntimeError(_V2_4_WARNING_MESSAGE)
152+
if ray_version != "2.9.3":
153+
raise RuntimeError(
154+
f"Ray version {ray_version} is not supported to convert a XGBoost"
155+
" checkpoint to XGBoost model on Vertex yet. Please use Ray 2.9.3."
156+
)
143157

144158
try:
145159
# This works for Ray v2.5

setup.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,19 @@
101101
preview_extra_require = []
102102

103103
ray_extra_require = [
104-
# Cluster only supports 2.9.3. Keep 2.4.0 for our testing environment.
104+
# Cluster only supports 2.9.3 and 2.33.0. Keep 2.4.0 for our testing environment.
105105
# Note that testing is submiting a job in a cluster with Ray 2.9.3 remotely.
106106
(
107-
"ray[default] >= 2.4, <= 2.9.3,!= 2.5.*,!= 2.6.*,!= 2.7.*,!="
108-
" 2.8.*,!=2.9.0,!=2.9.1,!=2.9.2; python_version<'3.11'"
107+
"ray[default] >= 2.4, <= 2.33.0,!= 2.5.*,!= 2.6.*,!= 2.7.*,!="
108+
" 2.8.*,!=2.9.0,!=2.9.1,!=2.9.2, !=2.10.*, !=2.11.*, !=2.12.*, !=2.13.*, !="
109+
" 2.14.*, !=2.15.*, !=2.16.*, !=2.17.*, !=2.18.*, !=2.19.*, !=2.20.*, !="
110+
" 2.21.*, !=2.22.*, !=2.23.*, !=2.24.*, !=2.25.*, !=2.26.*, !=2.27.*, !="
111+
" 2.28.*, !=2.29.*, !=2.30.*, !=2.31.*, !=2.32.*; python_version<'3.11'"
109112
),
110113
# To avoid ImportError: cannot import name 'packaging' from 'pkg)resources'
111114
"setuptools < 70.0.0",
112115
# Ray Data v2.4 in Python 3.11 is broken, but got fixed in Ray v2.5.
113-
"ray[default] >= 2.5, <= 2.9.3; python_version=='3.11'",
116+
"ray[default] >= 2.5, <= 2.33.0; python_version=='3.11'",
114117
"google-cloud-bigquery-storage",
115118
"google-cloud-bigquery",
116119
"pandas >= 1.0.0, < 2.2.0",

0 commit comments

Comments
 (0)