diff --git a/.buildkite/serve.rayci.yml b/.buildkite/serve.rayci.yml index a47c5d2d0294..e72e6c63f6f2 100644 --- a/.buildkite/serve.rayci.yml +++ b/.buildkite/serve.rayci.yml @@ -5,8 +5,8 @@ steps: wanda: ci/docker/serve.build.wanda.yaml depends_on: oss-ci-base_build - - name: servepydantic2build - wanda: ci/docker/servepydantic2.build.wanda.yaml + - name: servepydantic1build + wanda: ci/docker/servepydantic1.build.wanda.yaml depends_on: oss-ci-base_build - name: servepython311build @@ -28,7 +28,7 @@ steps: depends_on: servebuild job_env: forge - - label: ":ray-serve: serve: pydantic >= 2.0 tests" + - label: ":ray-serve: serve: pydantic < 2.0 tests" parallelism: 2 tags: - serve @@ -39,8 +39,8 @@ steps: - bazel run //ci/ray_ci:test_in_docker -- //python/ray/serve/... //python/ray/tests/... serve --except-tags post_wheel_build,gpu,worker-container,xcommit --workers "$${BUILDKITE_PARALLEL_JOB_COUNT}" --worker-id "$${BUILDKITE_PARALLEL_JOB}" --parallelism-per-worker 3 - --build-name servepydantic2build --test-env=EXPECTED_PYTHON_VERSION=3.8 --test-env=EXPECTED_PYDANTIC_VERSION=2.4.2 - depends_on: servepydantic2build + --build-name servepydantic1build --test-env=EXPECTED_PYTHON_VERSION=3.8 --test-env=EXPECTED_PYDANTIC_VERSION=1.10.12 + depends_on: servepydantic1build job_env: forge - label: ":ray-serve: serve: Python 3.11 tests" diff --git a/ci/docker/serve.build.Dockerfile b/ci/docker/serve.build.Dockerfile index 733d8c8cf802..895ab4543fae 100644 --- a/ci/docker/serve.build.Dockerfile +++ b/ci/docker/serve.build.Dockerfile @@ -4,7 +4,7 @@ ARG DOCKER_IMAGE_BASE_BUILD=cr.ray.io/rayproject/oss-ci-base_build FROM $DOCKER_IMAGE_BASE_BUILD ARG PYTHON_VERSION -ARG PYDANTIC_BUILD_COMMIT +ARG PYDANTIC_VERSION # Unset dind settings; we are using the host's docker daemon. ENV DOCKER_TLS_CERTDIR= @@ -45,8 +45,8 @@ pip install -c python/requirements_compiled.txt aioboto3 git clone https://github.com/wg/wrk.git /tmp/wrk && pushd /tmp/wrk && make -j && sudo cp wrk /usr/local/bin && popd # Install custom Pydantic version if requested. -if [[ -n "${PYDANTIC_BUILD_COMMIT-}" ]]; then - pip install -U git+https://github.com/pydantic/pydantic@$PYDANTIC_BUILD_COMMIT +if [[ -n "${PYDANTIC_VERSION-}" ]]; then + pip install -U pydantic==$PYDANTIC_VERSION else echo "Not installing Pydantic from source" fi diff --git a/ci/docker/servepydantic1.build.wanda.yaml b/ci/docker/servepydantic1.build.wanda.yaml new file mode 100644 index 000000000000..84dda6497b19 --- /dev/null +++ b/ci/docker/servepydantic1.build.wanda.yaml @@ -0,0 +1,11 @@ +name: "servepydantic1build" +froms: ["cr.ray.io/rayproject/oss-ci-base_build"] +dockerfile: ci/docker/serve.build.Dockerfile +srcs: + - python/requirements.txt + - python/requirements_compiled.txt + - python/requirements/test-requirements.txt +build_args: + - PYDANTIC_VERSION=1.10.12 +tags: + - cr.ray.io/rayproject/servepydantic1build diff --git a/ci/docker/servepydantic2.build.wanda.yaml b/ci/docker/servepydantic2.build.wanda.yaml deleted file mode 100644 index 1910f1340dfc..000000000000 --- a/ci/docker/servepydantic2.build.wanda.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: "servepydantic2build" -froms: ["cr.ray.io/rayproject/oss-ci-base_build"] -dockerfile: ci/docker/serve.build.Dockerfile -srcs: - - python/requirements.txt - - python/requirements_compiled.txt - - python/requirements/test-requirements.txt -build_args: - # Pydantic commit containing fixes for - # https://github.com/pydantic/pydantic/issues/6763. - # We can stop building from source once the next release containing - # these fixes goes out (should be 2.5.0). - - PYDANTIC_BUILD_COMMIT=60c5db6e1ea55d4e5fc13234810d513b3b1b03ae -tags: - - cr.ray.io/rayproject/servepydantic2build diff --git a/doc/requirements-doc.txt b/doc/requirements-doc.txt index 5a5c37e359f5..e660e58313c9 100644 --- a/doc/requirements-doc.txt +++ b/doc/requirements-doc.txt @@ -19,10 +19,10 @@ sphinx-sitemap==2.2.0 sphinxcontrib-redoc==1.6.0 sphinx-tabs==3.4.0 sphinx-remove-toctrees==0.0.3 -autodoc_pydantic==1.6.1 +autodoc_pydantic==2.0.1 sphinx_design==0.4.1 -pydantic<2 # Pydantic is required by autodoc_pydantic, but must be <2 for ray +pydantic!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3 # MyST myst-parser==0.15.2 diff --git a/doc/source/_templates/autosummary/class_with_inherited_members.rst b/doc/source/_templates/autosummary/class_with_inherited_members.rst new file mode 100644 index 000000000000..21b10a6d5150 --- /dev/null +++ b/doc/source/_templates/autosummary/class_with_inherited_members.rst @@ -0,0 +1,7 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :inherited-members: pydantic.BaseModel diff --git a/doc/source/ray-overview/pip_freeze_ray-ml-py39-cpu.txt b/doc/source/ray-overview/pip_freeze_ray-ml-py39-cpu.txt index 20e4672efa54..e827774e3e4f 100644 --- a/doc/source/ray-overview/pip_freeze_ray-ml-py39-cpu.txt +++ b/doc/source/ray-overview/pip_freeze_ray-ml-py39-cpu.txt @@ -96,7 +96,7 @@ databricks-cli==0.18.0 datasets==2.0.0 debugpy==1.8.0 decorator==5.1.1 -deepspeed==0.8.3 +deepspeed==0.12.3 defusedxml==0.7.1 Deprecated==1.2.14 dill==0.3.7 diff --git a/doc/source/serve/api/index.md b/doc/source/serve/api/index.md index 4e51dcb11b27..eef56a6e5e95 100644 --- a/doc/source/serve/api/index.md +++ b/doc/source/serve/api/index.md @@ -354,6 +354,7 @@ Content-Type: application/json .. autosummary:: :nosignatures: :toctree: doc/ + :template: autosummary/class_with_inherited_members.rst schema.ServeInstanceDetails schema.ApplicationDetails diff --git a/python/ray/_private/pydantic_compat.py b/python/ray/_private/pydantic_compat.py index 0bf7a6cce822..8cfc64e26050 100644 --- a/python/ray/_private/pydantic_compat.py +++ b/python/ray/_private/pydantic_compat.py @@ -57,3 +57,35 @@ root_validator, validator, ) + + +def register_pydantic_serializers(serialization_context): + if not PYDANTIC_INSTALLED: + return + + if IS_PYDANTIC_2: + # TODO(edoakes): compare against the version that has the fixes. + from pydantic.v1.fields import ModelField + else: + from pydantic.fields import ModelField + + # Pydantic's Cython validators are not serializable. + # https://github.com/cloudpipe/cloudpickle/issues/408 + serialization_context._register_cloudpickle_serializer( + ModelField, + custom_serializer=lambda o: { + "name": o.name, + # outer_type_ is the original type for ModelFields, + # while type_ can be updated later with the nested type + # like int for List[int]. + "type_": o.outer_type_, + "class_validators": o.class_validators, + "model_config": o.model_config, + "default": o.default, + "default_factory": o.default_factory, + "required": o.required, + "alias": o.alias, + "field_info": o.field_info, + }, + custom_deserializer=lambda kwargs: ModelField(**kwargs), + ) diff --git a/python/ray/autoscaler/_private/commands.py b/python/ray/autoscaler/_private/commands.py index d32b1b239043..e0b6ef7f514f 100644 --- a/python/ray/autoscaler/_private/commands.py +++ b/python/ray/autoscaler/_private/commands.py @@ -112,7 +112,9 @@ def try_reload_log_state(provider_config: Dict[str, Any], log_state: dict) -> No return reload_log_state(log_state) -def debug_status(status, error, verbose: bool = False, address: str = None) -> str: +def debug_status( + status, error, verbose: bool = False, address: Optional[str] = None +) -> str: """ Return a debug string for the autoscaler. @@ -1058,7 +1060,7 @@ def attach_cluster( def exec_cluster( config_file: str, *, - cmd: str = None, + cmd: Optional[str] = None, run_env: str = "auto", screen: bool = False, tmux: bool = False, diff --git a/python/ray/autoscaler/sdk/sdk.py b/python/ray/autoscaler/sdk/sdk.py index 42c5557ac7b8..8cb07e947016 100644 --- a/python/ray/autoscaler/sdk/sdk.py +++ b/python/ray/autoscaler/sdk/sdk.py @@ -128,7 +128,7 @@ def rsync( source: Optional[str], target: Optional[str], down: bool, - ip_address: str = None, + ip_address: Optional[str] = None, use_internal_ip: bool = False, no_config_cache: bool = False, should_bootstrap: bool = True diff --git a/python/ray/tests/test_client.py b/python/ray/tests/test_client.py index 43ed1dc9f4f3..39d61e3a7d45 100644 --- a/python/ray/tests/test_client.py +++ b/python/ray/tests/test_client.py @@ -6,9 +6,12 @@ import threading import time from unittest.mock import Mock, patch +from typing import Type import numpy as np import pytest +from pydantic import BaseModel as BaseModelV2 +from pydantic.v1 import BaseModel as BaseModelV1 import ray.cloudpickle as cloudpickle import ray.util.client.server.server as ray_client_server @@ -686,10 +689,9 @@ def test_client_gpu_ids(call_ray_start_shared): assert ray.get_gpu_ids() == [] -def test_client_serialize_addon(call_ray_start_shared): - import pydantic - - class User(pydantic.BaseModel): +@pytest.mark.parametrize("BaseModel", [BaseModelV1, BaseModelV2]) +def test_client_serialize_addon(call_ray_start_shared, BaseModel: Type): + class User(BaseModel): name: str with ray_start_client_server_for_address(call_ray_start_shared) as ray: diff --git a/python/ray/tests/test_pydantic_serialization.py b/python/ray/tests/test_pydantic_serialization.py index 93ee43d0d75b..bcc8c4d25833 100644 --- a/python/ray/tests/test_pydantic_serialization.py +++ b/python/ray/tests/test_pydantic_serialization.py @@ -1,15 +1,27 @@ from dataclasses import dataclass -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Type +import os +import sys import pytest from fastapi import FastAPI -# Intentionally import directly from pydantic instead of pydantic_compat because -# we want to test serializing both the v1 and v2 model implementations. -from pydantic import BaseModel +try: + # Testing with Pydantic 2 + from pydantic import BaseModel as BaseModelV2 + from pydantic.v1 import BaseModel as BaseModelV1 + + BASE_MODELS = [BaseModelV1, BaseModelV2] +except ImportError: + # Testing with Pydantic 1 + from pydantic import BaseModel as BaseModelV1 + + BaseModelV2 = None + BASE_MODELS = [BaseModelV1] import ray -from ray._private.pydantic_compat import IS_PYDANTIC_2 + +from ray.tests.pydantic_module import User, app, user, closure @pytest.fixture(scope="session") @@ -17,38 +29,40 @@ def start_ray(): ray.init(ignore_reinit_error=True) -def test_serialize_cls(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_cls(start_ray, BaseModel: Type): class User(BaseModel): name: str ray.get(ray.put(User)) -def test_serialize_instance(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_instance(start_ray, BaseModel: Type): class User(BaseModel): name: str ray.get(ray.put(User(name="a"))) -def test_serialize_imported_cls(start_ray): - from pydantic_module import User - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_imported_cls(start_ray, BaseModel: Type): ray.get(ray.put(User)) -def test_serialize_imported_instance(start_ray): - from pydantic_module import user - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_imported_instance(start_ray, BaseModel: Type): ray.get(ray.put(user)) -def test_serialize_app_no_route(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_no_route(start_ray, BaseModel: Type): app = FastAPI() ray.get(ray.put(app)) -def test_serialize_app_no_validation(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_no_validation(start_ray, BaseModel: Type): app = FastAPI() @app.get("/") @@ -58,7 +72,8 @@ def hello() -> str: ray.get(ray.put(app)) -def test_serialize_app_primitive_type(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_primitive_type(start_ray, BaseModel: Type): app = FastAPI() @app.get("/") @@ -68,9 +83,8 @@ def hello(v: str) -> str: ray.get(ray.put(app)) -def test_serialize_app_pydantic_type_imported(start_ray): - from pydantic_module import User - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_pydantic_type_imported(start_ray, BaseModel: Type): app = FastAPI() @app.get("/") @@ -80,7 +94,8 @@ def hello(v: str, u: User) -> str: ray.get(ray.put(app)) -def test_serialize_app_pydantic_type_inline(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_pydantic_type_inline(start_ray, BaseModel: Type): class User(BaseModel): name: str @@ -93,13 +108,13 @@ def hello(v: str, u: User) -> str: ray.get(ray.put(app)) -def test_serialize_app_imported(start_ray): - from pydantic_module import app - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_imported(start_ray, BaseModel: Type): ray.get(ray.put(app)) -def test_serialize_app_pydantic_type_closure_ref(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_pydantic_type_closure_ref(start_ray, BaseModel: Type): class User(BaseModel): name: str @@ -115,9 +130,8 @@ def hello(v: str, u: User) -> str: ray.get(ray.put(make)) -def test_serialize_app_pydantic_type_closure_ref_import(start_ray): - from pydantic_module import User - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_pydantic_type_closure_ref_import(start_ray, BaseModel: Type): def make(): app = FastAPI() @@ -130,7 +144,8 @@ def hello(v: str, u: User) -> str: ray.get(ray.put(make)) -def test_serialize_app_pydantic_type_closure(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_pydantic_type_closure(start_ray, BaseModel: Type): def make(): class User(BaseModel): name: str @@ -146,17 +161,14 @@ def hello(v: str, u: User) -> str: ray.get(ray.put(make)) -def test_serialize_app_imported_closure(start_ray): - from pydantic_module import closure - +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_app_imported_closure(start_ray, BaseModel: Type): ray.get(ray.put(closure)) -@pytest.mark.skipif( - not IS_PYDANTIC_2, - reason="Test fails with Pydantic 1.10.12, but succeeds with Pydantic 1.9.2.", -) -def test_serialize_serve_dataclass(start_ray): +# TODO: Serializing a Serve dataclass doesn't work in Pydantic 1.10 – 2.0. +@pytest.mark.parametrize("BaseModel", [BaseModelV2] if BaseModelV2 else []) +def test_serialize_serve_dataclass(start_ray, BaseModel: Type): @dataclass class BackendMetadata: is_blocking: bool = True @@ -174,7 +186,8 @@ def consume(f): ray.get(consume.remote(BackendConfig())) -def test_serialize_nested_field(start_ray): +@pytest.mark.parametrize("BaseModel", BASE_MODELS) +def test_serialize_nested_field(start_ray, BaseModel: Type): class B(BaseModel): v: List[int] @@ -190,9 +203,6 @@ def func(): if __name__ == "__main__": - import os - import sys - if os.environ.get("PARALLEL_CI"): sys.exit(pytest.main(["-n", "auto", "--boxed", "-vs", __file__])) else: diff --git a/python/ray/tests/test_serialization.py b/python/ray/tests/test_serialization.py index c042faeae075..084ff8b5cf37 100644 --- a/python/ray/tests/test_serialization.py +++ b/python/ray/tests/test_serialization.py @@ -678,33 +678,6 @@ def custom_deserializer(b): ray.get(ray.put(A(1))) # success! -def test_serialization_pydantic(ray_start_regular): - @ray.remote - def test(pydantic_model): - return pydantic_model.x - - @ray.remote(runtime_env={"pip": ["pydantic<2"]}) - def py1(): - from pydantic import BaseModel - - class Foo(BaseModel): - x: int - - return ray.get(test.remote(Foo(x=1))) - - @ray.remote(runtime_env={"pip": ["pydantic>=2"]}) - def py2(): - from pydantic.v1 import BaseModel - - class Foo(BaseModel): - x: int - - return ray.get(test.remote(Foo(x=2))) - - assert ray.get(py1.remote()) == 1 - assert ray.get(py2.remote()) == 2 - - if __name__ == "__main__": import os import pytest diff --git a/python/ray/tests/test_typing.py b/python/ray/tests/test_typing.py index e36416bd2e0a..ee03f04fa232 100644 --- a/python/ray/tests/test_typing.py +++ b/python/ray/tests/test_typing.py @@ -1,49 +1,46 @@ import os import shutil import sys +import tempfile import mypy.api as mypy_api import pytest -TYPING_TEST_DIRS = os.path.join(os.path.dirname(__file__), "typing_files") + +# Paths are relative to the directory where Bazel is run in the CI +TYPING_GOOD_PATH = "python/ray/tests/typing_files/check_typing_good.py" +TYPING_BAD_PATH = "python/ray/tests/typing_files/check_typing_bad.py" def test_typing_good(): - script = "check_typing_good.py" - # the following check indicates that check_typing_good.py - # is not present in the current directory, so follow - # the path specified TYPING_TEST_DIRS - if not os.path.exists(script): - script = os.path.join(TYPING_TEST_DIRS, script) - _, msg, status_code = mypy_api.run([script]) + typing_good_tmp_path = create_tmp_copy(TYPING_GOOD_PATH) + _, msg, status_code = mypy_api.run([typing_good_tmp_path]) assert status_code == 0, msg def test_typing_bad(): - script = "check_typing_bad.py" - # the following check indicates that check_typing_bad.py - # is not present in the current directory, so follow - # the path specified TYPING_TEST_DIRS - if not os.path.exists(script): - script = os.path.join(TYPING_TEST_DIRS, script) - _, msg, status_code = mypy_api.run([script]) + typing_bad_tmp_path = create_tmp_copy(TYPING_BAD_PATH) + _, msg, status_code = mypy_api.run([typing_bad_tmp_path]) assert status_code == 1, msg +def create_tmp_copy(file_path: str) -> str: + """Copies file at file_path to a temporary file and returns the path.""" + + base_file_name = os.path.basename(file_path) + tmp_dir = tempfile.gettempdir() + tmp_path = os.path.join(tmp_dir, base_file_name) + shutil.copy(file_path, tmp_path) + print(f"Copied file at {file_path} to {tmp_path}") + + return tmp_path + + if __name__ == "__main__": # Make subprocess happy in bazel. os.environ["LC_ALL"] = "en_US.UTF-8" os.environ["LANG"] = "en_US.UTF-8" - # copying is necessary because otherwise, ray is imported from the source - # files in directory, `Bazel.runfiles_*/runfiles/com_github_ray_project_ray/python` - # and mypy is unable to detect attributes that should be present in ray. - typing_files_dir = "python/ray/tests/typing_files/" - checking_typing_good = typing_files_dir + "check_typing_good.py" - checking_typing_bad = typing_files_dir + "check_typing_bad.py" - if os.path.exists(checking_typing_good): - shutil.copy(checking_typing_good, os.getcwd()) - if os.path.exists(checking_typing_bad): - shutil.copy(checking_typing_bad, os.getcwd()) + if os.environ.get("PARALLEL_CI"): sys.exit(pytest.main(["-n", "auto", "--boxed", "-vs", __file__])) else: diff --git a/python/ray/util/serialization_addons.py b/python/ray/util/serialization_addons.py index ef4b4c1af902..cdf0b50a7a22 100644 --- a/python/ray/util/serialization_addons.py +++ b/python/ray/util/serialization_addons.py @@ -6,55 +6,7 @@ import sys from ray.util.annotations import DeveloperAPI - - -@DeveloperAPI -def register_pydantic_serializer(serialization_context): - try: - from pydantic import fields - except ImportError: - fields = None - - try: - from pydantic.v1 import fields as pydantic_v1_fields - except ImportError: - pydantic_v1_fields = None - - if hasattr(fields, "ModelField"): - ModelField = fields.ModelField - elif pydantic_v1_fields: - ModelField = pydantic_v1_fields.ModelField - else: - ModelField = None - - if ModelField is not None: - # In Pydantic 2.x, ModelField has been removed so this serialization - # strategy no longer works. We keep this code around to allow support - # for users with pydantic 1.x installed or users using pydantic.v1 - # import within the pydantic 2.x package. - # TODO(aguo): Figure out how to enable cloudpickle serialization for - # pydantic 2.x - - # Pydantic's Cython validators are not serializable. - # https://github.com/cloudpipe/cloudpickle/issues/408 - serialization_context._register_cloudpickle_serializer( - ModelField, - custom_serializer=lambda o: { - "name": o.name, - # outer_type_ is the original type for ModelFields, - # while type_ can be updated later with the nested type - # like int for List[int]. - "type_": o.outer_type_, - "class_validators": o.class_validators, - "model_config": o.model_config, - "default": o.default, - "default_factory": o.default_factory, - "required": o.required, - "alias": o.alias, - "field_info": o.field_info, - }, - custom_deserializer=lambda kwargs: ModelField(**kwargs), - ) +from ray._private.pydantic_compat import register_pydantic_serializers @DeveloperAPI @@ -75,7 +27,7 @@ def register_starlette_serializer(serialization_context): @DeveloperAPI def apply(serialization_context): - register_pydantic_serializer(serialization_context) + register_pydantic_serializers(serialization_context) register_starlette_serializer(serialization_context) if sys.platform != "win32": diff --git a/python/requirements.txt b/python/requirements.txt index 3a226f356298..89bb00cf7882 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -58,6 +58,6 @@ starlette typer fsspec pandas>=1.3 -pydantic<2 +pydantic!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3 # Serve users can use pydantic<2 py-spy>=0.2.0 watchfiles diff --git a/python/requirements/lint-requirements.txt b/python/requirements/lint-requirements.txt index 530fc2435b24..8b0ae01d336f 100644 --- a/python/requirements/lint-requirements.txt +++ b/python/requirements/lint-requirements.txt @@ -4,7 +4,7 @@ flake8==3.9.1 flake8-comprehensions==3.10.1 flake8-quotes==2.0.0 flake8-bugbear==21.9.2 -mypy==0.982 +mypy==1.7.0 types-PyYAML==6.0.12.2 black==22.10.0 isort==5.10.1 diff --git a/python/requirements/ml/train-requirements.txt b/python/requirements/ml/train-requirements.txt index 60aa442b4c32..397c7e254855 100644 --- a/python/requirements/ml/train-requirements.txt +++ b/python/requirements/ml/train-requirements.txt @@ -1,2 +1,2 @@ -deepspeed==0.8.3 +deepspeed==0.12.3 datasets diff --git a/python/requirements/test-requirements.txt b/python/requirements/test-requirements.txt index f93087db50eb..06d2d1776111 100644 --- a/python/requirements/test-requirements.txt +++ b/python/requirements/test-requirements.txt @@ -32,7 +32,7 @@ kubernetes==24.2.0 llvmlite==0.41.1 lxml==4.9.1 moto[s3,server]==4.0.7 -mypy==0.982 +mypy==1.7.0 numba==0.58.1 openpyxl==3.0.10 opentelemetry-api==1.1.0 @@ -42,7 +42,7 @@ opentelemetry-exporter-opencensus==0.20b0 pexpect==4.8.0 Pillow==9.2.0; platform_system != "Windows" proxy.py==2.4.3 -pydantic==1.10.12 +pydantic==2.5.0 pydot==1.4.2 # Keep in sync with `ci/build/upload_build_info.sh` PyOpenSSL==22.1.0 diff --git a/python/requirements_compiled.txt b/python/requirements_compiled.txt index 287b4de8b1b6..08cb88139701 100644 --- a/python/requirements_compiled.txt +++ b/python/requirements_compiled.txt @@ -79,14 +79,17 @@ alembic==1.12.1 # aim # mlflow # optuna -alive-progress==3.1.4 +alive-progress==3.1.5 # via pymoo altair==5.1.2 # via gradio +annotated-types==0.6.0 + # via pydantic anyio==3.7.1 # via # fastapi # httpcore + # httpx # jupyter-server # starlette # watchfiles @@ -136,7 +139,7 @@ attrs==21.4.0 # sarif-om # semgrep # sphinx-external-toc -autodoc-pydantic==1.6.1 +autodoc-pydantic==2.0.1 # via -r /ray/ci/../doc/requirements-doc.txt autograd==1.6.2 # via pymoo @@ -258,9 +261,9 @@ cffi==1.16.0 # pymunk # pynacl # soundfile -cfn-lint==0.83.1 +cfn-lint==0.83.3 # via moto -charset-normalizer==3.3.1 +charset-normalizer==3.3.2 # via # aiohttp # requests @@ -317,6 +320,7 @@ colorama==0.4.6 # bayesian-optimization # nbdime # semgrep + # typer coloredlogs==15.0.1 # via onnxruntime colorful==0.5.5 @@ -325,7 +329,7 @@ colorlog==6.7.0 # via optuna comet-ml==3.31.9 # via -r /ray/ci/../python/requirements/ml/core-requirements.txt -comm==0.1.4 +comm==0.2.0 # via # ipykernel # ipywidgets @@ -384,7 +388,7 @@ decorator==5.1.1 # ipython # paramz # tensorflow-probability -deepspeed==0.8.3 +deepspeed==0.12.3 # via -r /ray/ci/../python/requirements/ml/train-requirements.txt defusedxml==0.7.1 # via @@ -462,7 +466,7 @@ etils==1.3.0 # tensorflow-datasets evaluate==0.4.0 # via -r /ray/ci/../python/requirements/ml/train-test-requirements.txt -everett==3.2.0 +everett==3.3.0 # via comet-ml exceptiongroup==1.1.3 # via anyio @@ -486,7 +490,7 @@ fasteners==0.19 # via # google-apitools # gsutil -fastjsonschema==2.18.1 +fastjsonschema==2.19.0 # via nbformat feather-format==0.4.1 # via -r /ray/ci/../python/requirements/test-requirements.txt @@ -532,7 +536,7 @@ flatbuffers==2.0.7 # tf2onnx flax==0.7.2 # via dopamine-rl -fonttools==4.43.1 +fonttools==4.44.3 # via matplotlib fqdn==1.5.1 # via jsonschema @@ -585,7 +589,7 @@ glfw==2.6.2 # mujoco glom==22.1.0 # via semgrep -google-api-core==2.12.0 +google-api-core==2.14.0 # via # google-api-python-client # google-cloud-bigquery @@ -728,7 +732,7 @@ httpx==0.24.1 # via # gradio # gradio-client -huggingface-hub==0.18.0 +huggingface-hub==0.19.3 # via # datasets # evaluate @@ -764,6 +768,7 @@ importlib-metadata==4.10.0 # -r /ray/ci/../python/requirements/test-requirements.txt # ale-py # alembic + # autodoc-pydantic # flask # gym # gymnasium @@ -1013,7 +1018,7 @@ lxml==4.9.1 # vsphere-automation-sdk lz4==4.3.2 # via -r /ray/ci/../python/requirements.txt -mako==1.2.4 +mako==1.3.0 # via alembic markdown==3.5.1 # via @@ -1066,8 +1071,7 @@ mlagents-envs==0.28.0 mlflow==2.4.1 # via -r /ray/ci/../python/requirements/ml/core-requirements.txt mock==5.1.0 - # via - # pytest-shutil + # via pytest-shutil modin==0.22.2 # via -r /ray/ci/../python/requirements/ml/data-requirements.txt monotonic==1.6 @@ -1124,7 +1128,7 @@ multiprocess==0.70.15 # via # datasets # evaluate -mypy==0.982 +mypy==1.7.0 # via # -r /ray/ci/../python/requirements/lint-requirements.txt # -r /ray/ci/../python/requirements/test-requirements.txt @@ -1307,7 +1311,7 @@ numpy==1.23.5 ; python_version < "3.9" # xgboost # xgboost-ray # zoopt -nvidia-ml-py==12.535.108 +nvidia-ml-py==12.535.133 # via gpustat oauth2client==4.1.3 # via @@ -1464,7 +1468,7 @@ pathtools==0.1.2 # via wandb patsy==0.5.3 # via statsmodels -pbr==5.11.1 +pbr==6.0.0 # via # jschema-to-python # sarif-om @@ -1521,7 +1525,7 @@ promise==2.3 # via # tensorflow-datasets # wandb -prompt-toolkit==3.0.39 +prompt-toolkit==3.0.41 # via ipython proto-plus==1.22.3 # via @@ -1614,7 +1618,7 @@ pycodestyle==2.7.0 # via flake8 pycparser==2.21 # via cffi -pydantic==1.10.12 +pydantic==2.5.0 # via # -r /ray/ci/../doc/requirements-doc.txt # -r /ray/ci/../python/requirements.txt @@ -1624,6 +1628,11 @@ pydantic==1.10.12 # deepspeed # fastapi # gradio + # pydantic-settings +pydantic-core==2.14.1 + # via pydantic +pydantic-settings==2.1.0 + # via autodoc-pydantic pydata-sphinx-theme==0.8.1 # via sphinx-book-theme pydeprecate==0.3.2 @@ -1762,6 +1771,8 @@ python-dateutil==2.8.2 # moto # pandas # segment-analytics-python +python-dotenv==1.0.0 + # via pydantic-settings python-jose==3.3.0 # via moto python-json-logger==2.0.7 @@ -1908,7 +1919,6 @@ requests-toolbelt==1.0.0 responses==0.13.4 # via # -r /ray/ci/../python/requirements/ml/data-requirements.txt - # datasets # evaluate # moto restrictedpython==6.2 @@ -1933,6 +1943,7 @@ rich==12.6.0 # flax # memray # semgrep + # typer rsa==4.7.2 # via # gcs-oauth2-boto-plugin @@ -2019,7 +2030,7 @@ send2trash==1.8.2 # notebook sentencepiece==0.1.96 # via -r /ray/ci/../python/requirements/ml/train-test-requirements.txt -sentry-sdk==1.33.1 +sentry-sdk==1.35.0 # via # comet-ml # wandb @@ -2031,6 +2042,8 @@ setproctitle==1.3.3 # via wandb shellcheck-py==0.7.1.1 # via -r /ray/ci/../python/requirements/lint-requirements.txt +shellingham==1.5.4 + # via typer shimmy==1.3.0 # via -r /ray/ci/../python/requirements/ml/rllib-test-requirements.txt shortuuid==1.0.1 @@ -2245,7 +2258,7 @@ termcolor==2.3.0 # pytest-sugar # tensorflow # tensorflow-datasets -terminado==0.17.1 +terminado==0.18.0 # via # jupyter-server # nbclassic @@ -2283,8 +2296,10 @@ tomli==2.0.1 # mypy # pytest # semgrep -tomlkit==0.12.1 - # via yq +tomlkit==0.12.0 + # via + # gradio + # yq toolz==0.12.0 # via # altair @@ -2386,7 +2401,9 @@ trustme==0.9.0 typeguard==2.13.3 # via ax-platform typer==0.9.0 - # via -r /ray/ci/../python/requirements.txt + # via + # -r /ray/ci/../python/requirements.txt + # gradio types-python-dateutil==2.8.19.14 # via arrow types-pyyaml==6.0.12.2 @@ -2398,6 +2415,7 @@ typing-extensions==4.8.0 # ale-py # alembic # altair + # annotated-types # aws-sam-translator # azure-core # black @@ -2418,6 +2436,7 @@ typing-extensions==4.8.0 # orbax-checkpoint # polars # pydantic + # pydantic-core # pytorch-lightning # rich # semgrep @@ -2490,7 +2509,7 @@ watchfiles==0.19.0 # -r /ray/ci/../python/requirements/test-requirements.txt wcmatch==8.5 # via semgrep -wcwidth==0.2.9 +wcwidth==0.2.10 # via # blessed # prompt-toolkit @@ -2509,7 +2528,6 @@ websocket-client==1.6.4 websockets==11.0.3 # via # -r /ray/ci/../python/requirements/test-requirements.txt - # gradio # gradio-client werkzeug==2.1.2 # via @@ -2526,7 +2544,7 @@ wheel==0.41.3 # tensorboard widgetsnbextension==3.6.6 # via ipywidgets -wrapt==1.15.0 +wrapt==1.16.0 # via # aiobotocore # aws-xray-sdk diff --git a/python/setup.py b/python/setup.py index ab036bdfa325..48df2064b749 100644 --- a/python/setup.py +++ b/python/setup.py @@ -251,7 +251,7 @@ def get_packages(self): "grpcio >= 1.32.0; python_version < '3.10'", # noqa:E501 "grpcio >= 1.42.0; python_version >= '3.10'", # noqa:E501 "opencensus", - "pydantic < 2", # 2.0.0 brings breaking changes + "pydantic!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3", "prometheus_client >= 0.7.1", "smart_open", "virtualenv >=20.0.24, < 20.21.1", # For pip runtime env. diff --git a/release/ray_release/byod/byod_finetune_llvms.sh b/release/ray_release/byod/byod_finetune_llvms.sh index 5052b4ebfc3b..f752c2655370 100755 --- a/release/ray_release/byod/byod_finetune_llvms.sh +++ b/release/ray_release/byod/byod_finetune_llvms.sh @@ -8,7 +8,7 @@ pip3 install -U \ torch==2.0.0 \ torchvision==0.15.1 \ torchaudio==2.0.1 \ - deepspeed==0.10.0 \ + deepspeed==0.12.3 \ fairscale==0.4.13 \ datasets==2.14.4 \ accelerate==0.21.0 \