GeezerVison is showing github.com — feat: update setup.py for including Ray v2.33, restrict RoV predictio… · hirobf10/python-aiplatform@71c6f3c
File treeExpand file treeCollapse file tree Open diff view settings google/cloud/aiplatform/vertex_ray/predict
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/vertex_ray/predict/sklearn/register.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,7 +86,15 @@ def register_sklearn( | 86 | 86 |
| 87 | 87 | Raises: | 88 | 88 | ValueError: Invalid Argument. | | 89 | + RuntimeError: Only Ray version 2.9.3 is supported. | 89 | 90 | """ | | 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 | + | 90 | 98 | artifact_uri = artifact_uri or initializer.global_config.staging_bucket | 91 | 99 | predict_utils.validate_artifact_uri(artifact_uri) | 92 | 100 | display_model_name = ( | @@ -122,11 +130,17 @@ def _get_estimator_from( | 122 | 130 | ValueError: Invalid Argument. | 123 | 131 | RuntimeError: Model not found. | 124 | 132 | RuntimeError: Ray version 2.4 is not supported. | | 133 | + RuntimeError: Only Ray version 2.9.3 is supported. | 125 | 134 | """ | 126 | 135 |
| 127 | 136 | ray_version = ray.__version__ | 128 | 137 | if ray_version == "2.4.0": | 129 | 138 | 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 | + ) | 130 | 144 |
| 131 | 145 | try: | 132 | 146 | return checkpoint.get_model() | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/vertex_ray/predict/torch/register.py +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,10 +61,16 @@ def get_pytorch_model_from( | 61 | 61 | ModuleNotFoundError: PyTorch isn't installed. | 62 | 62 | RuntimeError: Model not found. | 63 | 63 | RuntimeError: Ray version 2.4 is not supported. | | 64 | + RuntimeError: Only Ray version 2.9.3 is supported. | 64 | 65 | """ | 65 | 66 | ray_version = ray.__version__ | 66 | 67 | if ray_version == "2.4.0": | 67 | 68 | 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 | + ) | 68 | 74 |
| 69 | 75 | try: | 70 | 76 | return checkpoint.get_model() | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/vertex_ray/predict/xgboost/register.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -94,7 +94,15 @@ def register_xgboost( | 94 | 94 |
| 95 | 95 | Raises: | 96 | 96 | ValueError: Invalid Argument. | | 97 | + RuntimeError: Only Ray version 2.9.3 is supported. | 97 | 98 | """ | | 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 | + | 98 | 106 | artifact_uri = artifact_uri or initializer.global_config.staging_bucket | 99 | 107 | predict_utils.validate_artifact_uri(artifact_uri) | 100 | 108 | display_model_name = ( | @@ -136,10 +144,16 @@ def _get_xgboost_model_from( | 136 | 144 | ModuleNotFoundError: XGBoost isn't installed. | 137 | 145 | RuntimeError: Model not found. | 138 | 146 | RuntimeError: Ray version 2.4 is not supported. | | 147 | + RuntimeError: Only Ray version 2.9.3 is supported. | 139 | 148 | """ | 140 | 149 | ray_version = ray.__version__ | 141 | 150 | if ray_version == "2.4.0": | 142 | 151 | 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 | + ) | 143 | 157 |
| 144 | 158 | try: | 145 | 159 | # This works for Ray v2.5 | |
Collapse file Copy file name to clipboardExpand all lines: setup.py +7-4Lines changed: 7 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 101 | 101 | preview_extra_require = [] | 102 | 102 |
| 103 | 103 | 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. | 105 | 105 | # Note that testing is submiting a job in a cluster with Ray 2.9.3 remotely. | 106 | 106 | ( | 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'" | 109 | 112 | ), | 110 | 113 | # To avoid ImportError: cannot import name 'packaging' from 'pkg)resources' | 111 | 114 | "setuptools < 70.0.0", | 112 | 115 | # 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'", | 114 | 117 | "google-cloud-bigquery-storage", | 115 | 118 | "google-cloud-bigquery", | 116 | 119 | "pandas >= 1.0.0, < 2.2.0", | |
|