fix: Add Pydantic v1, PyTorch 2.11, and NumPy v2 compatibility shims - #1
Open
VAmsIdhAR2340 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The version of DeepSpeed in the OSU repo (0.10.2) was fundamentally incompatible with the modern Python ecosystem required by vLLM and Transformers. Specifically, DeepSpeed was written for Pydantic v1 and older PyTorch elastic APIs, but our stack requires Pydantic v2 and PyTorch 2.11. This caused an endless loop of import errors and strict type-checking crashes during initialization.
Instead of downgrading our stack (which would break vLLM), I applied a global compatibility shim. I rewrote DeepSpeed's imports to use Pydantic's hidden v1 compatibility layer (pydantic.v1). I also patched out a few deprecated PyTorch and NumPy functions that were removed in the newer versions.
Now, DeepSpeed initializes perfectly. The test run executed 5 epochs of training at ~2,500 samples/sec, utilized ZeRO memory optimization.