Skip to content

[core] pydantic basemodel missing values #52525

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

Open
tekumara opened this issue Apr 22, 2025 · 2 comments
Open

[core] pydantic basemodel missing values #52525

tekumara opened this issue Apr 22, 2025 · 2 comments
Assignees
Labels
bug Something that is supposed to be working; but isn't python Pull requests that update Python code regression serve Ray Serve Related Issue stability triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@tekumara
Copy link
Contributor

tekumara commented Apr 22, 2025

What happened + What you expected to happen

pydantic base model instance created inside a remote function is missing values, eg:

❯ python -m raydemo.foo
2025-04-22 20:12:42,548 INFO worker.py:1843 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265 
outside=Prediction(key='foo')
(f pid=99091) f: in_f=Prediction()
ray_get=Prediction()

outside is correct but in_f and ray_get shows an empty Prediction() object

Versions / Dependencies

pydantic==2.11.3
pydantic-core==2.33.1
ray==2.44.1

Reproduction script

import ray
from pydantic import BaseModel


class Prediction(BaseModel):
    key: str


ray.init()

outside = Prediction(key="foo")
print(f"{outside=}")

@ray.remote
def f() -> Prediction:
    in_f = Prediction(key="foo")
    print(f"f: {in_f=}")
    return in_f


ray_get = ray.get(f.remote())

print(f"{ray_get=}")

Issue Severity

High: It blocks me from completing my task.

@tekumara tekumara added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Apr 22, 2025
@tekumara
Copy link
Contributor Author

This looks like a regression introduced by:

pydantic==2.11.0
pydantic-core==2.33.0

As versions pydantic<2.11 are ok.

@masoudcharkhabi masoudcharkhabi added core Issues that should be addressed in Ray Core python Pull requests that update Python code regression stability labels Apr 22, 2025
@jjyao jjyao added serve Ray Serve Related Issue and removed core Issues that should be addressed in Ray Core labels Apr 22, 2025
@zcin zcin self-assigned this Apr 22, 2025
@zcin
Copy link
Contributor

zcin commented Apr 25, 2025

I bisected it and it seems like this commit, i.e. pydantic-core==2.29.0 is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't python Pull requests that update Python code regression serve Ray Serve Related Issue stability triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

No branches or pull requests

4 participants