Skip to content

fix: don't init model in fp32 to avoid cpu oom - #295

Closed
parthchadha wants to merge 1 commit into
mainfrom
pchadha/init-model
Closed

parthchadha wants to merge 1 commit into
mainfrom
pchadha/init-model

Conversation

@parthchadha

Copy link
Copy Markdown
Contributor

What does this PR do ?

For a large model we CPU OOM because we are initializing the large model across all processes. Also, MixedPrecisionPolicy doesn't really require us to init the model in fp32 because anyway we provide the param type as fp16 there.

Note there are other ways to solve this problem like not initializing the model on all processes, using meta device for initialization etc but they add more complexity than required.

(will attach the convergence runs for grpo/sft when done).

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@terrykong terrykong linked an issue May 5, 2025 that may be closed by this pull request
@parthchadha parthchadha closed this May 8, 2025
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.

CPU OOM affecting 70b

1 participant