Skip to content
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

[PP] Fix PP meta init #582

Open
wants to merge 1 commit into
base: gh/wconstab/39/base
Choose a base branch
from
Open

Conversation

wconstab
Copy link
Contributor

@wconstab wconstab commented Sep 18, 2024

Stack from ghstack (oldest at bottom):

Uses meta device for tensors/model used before pipeline splitting.

Important:
Relies on pytorch/pytorch#136243 to make PipelineStage avoid
materializing the model and the input/output buffers eagerly.

Relies on existing .to(device) in train.py to finally materialize the
model.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Sep 18, 2024
Uses meta device for tensors/model used before pipeline splitting.

*Important:*
Relies on pytorch/pytorch#136243 to make PipelineStage avoid
materializing the model and the input/output buffers eagerly.

Relies on existing .to(device) in train.py to finally materialize the
model.

ghstack-source-id: 66fa9f1f78dff0b1af753dc4b2afcc09d897751d
Pull Request resolved: #582
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 18, 2024

model.to_empty(device=device)
stage = PipelineStage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to understand: the device arg for PipelineStage still needs to be the actual device, e.g. cuda, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. And I want to remove that too in PipelineStage but I didn't do it yet.

Copy link
Contributor

@kwen2501 kwen2501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@kwen2501
Copy link
Contributor

Relies on existing .to(device) in train.py to finally materialize the model.

Curious -- why would train.py make a .to call?

Should init_weight create tensor on the right device directly?

Or, if we are loading from DCP, would DCP return a state dict with DTensors on target device or just a state dict with DTensors on CPU?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants