Skip to content

Add PyDantic v2 support#3902

Closed
loadams wants to merge 12 commits intomasterfrom
loadams/try-bump-pydantic
Closed

Add PyDantic v2 support#3902
loadams wants to merge 12 commits intomasterfrom
loadams/try-bump-pydantic

Conversation

@loadams
Copy link
Collaborator

@loadams loadams commented Jul 7, 2023

Pydantic completed its update to V2, they released a tool called bump-pydantic that might do this for you, this PR tries that.

@mrwyattii
Copy link
Contributor

Note: Will need to merge deepspeedai/DeepSpeed-MII#213 before this one

@loadams loadams changed the title Run bump-pydantic tool to update pydantic v2 Add PyDantic v2 support Jul 27, 2023
@ringohoffman
Copy link

Note: Will need to merge microsoft/DeepSpeed-MII#213 before this one

@mrwyattii It looks like the tests for DeepSpeed and DeepSpeed-MII are interdependent on each other and also both depend on pydantic, so updating pydantic in one will make it incompatible with the other. What is the plan for continuing this upgrade?

@ringohoffman
Copy link

Here is LangChain's pydantic migration plan: https://github.com/langchain-ai/langchain/discussions/9337

They are able to support both pydantic v1 and v2. Perhaps DeepSpeed could follow suit? It's still unclear to me how to perform any kind of update when DeepSpeed and DeepSpeed-MII are interdependent.

@loadams
Copy link
Collaborator Author

loadams commented Sep 26, 2023

Here is LangChain's pydantic migration plan: langchain-ai/langchain#9337

They are able to support both pydantic v1 and v2. Perhaps DeepSpeed could follow suit? It's still unclear to me how to perform any kind of update when DeepSpeed and DeepSpeed-MII are interdependent.

Hi @ringohoffman - DeepSpeed and DeepSpeed-MII do rely on each other for tests, but what we would do, to update to pydantic v2 is to push the update to DeepSpeed-MII first (once we've run tests with both branches updated, by changing this on the DeepSpeed-MII side for example). Then the DeepSpeed PR should be able to pass tests, and we can enable DeepSpeed-MII to use the DeepSpeed master branch again.

Does that help answer your question for how we will merge these?

We haven't looked into supporting both pydantic v1 and v2 simultaneously, we've had a fairly large amount of work with just adopting v2, but we will discuss internally and let you know on supporting both.

@mrwyattii mrwyattii mentioned this pull request Feb 21, 2024
@loadams loadams closed this Feb 21, 2024
loadams added a commit that referenced this pull request Aug 22, 2024
Pydantic v2 has been out for some time now. We have been relying on
using the v1 API available in v2 until now. This is a refresh of #3902
to bring proper v2 support to DeepSpeed.

Corresponding DeepSpeed-MII PR
[here](deepspeedai/DeepSpeed-MII#423).

@loadams

---------

Co-authored-by: Logan Adams <[email protected]>
Co-authored-by: Logan Adams <[email protected]>
Co-authored-by: Olatunji Ruwase <[email protected]>
Co-authored-by: Abhishek Kulkarni <[email protected]>
Co-authored-by: Abhishek Kulkarni <[email protected]>
Co-authored-by: Lev Kurilenko <[email protected]>
mauryaavinash95 pushed a commit to DataStates/DeepSpeed that referenced this pull request Mar 20, 2025
Pydantic v2 has been out for some time now. We have been relying on
using the v1 API available in v2 until now. This is a refresh of deepspeedai#3902
to bring proper v2 support to DeepSpeed.

Corresponding DeepSpeed-MII PR
[here](deepspeedai/DeepSpeed-MII#423).

@loadams

---------

Co-authored-by: Logan Adams <[email protected]>
Co-authored-by: Logan Adams <[email protected]>
Co-authored-by: Olatunji Ruwase <[email protected]>
Co-authored-by: Abhishek Kulkarni <[email protected]>
Co-authored-by: Abhishek Kulkarni <[email protected]>
Co-authored-by: Lev Kurilenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants