Skip to content

Fix: prepare works even if nothing except tp specified (rare) #3707

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

Merged
merged 1 commit into from
Aug 5, 2025

Conversation

S1ro1
Copy link
Member

@S1ro1 S1ro1 commented Aug 4, 2025

If we only had TP specified, the training would probably be still correct, though the optimizer/dataloader wouldn't be accelerator prepared (in some cases). This was and is a rare case, as pure TP is not fully supported yet anyway. Though this PR fixes atleast this.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGMT. Just to be sure, this should be safe wrt to fsdpv2 for example ? Do we handle the states differently for these cases ? If tp is used, this will always to executed first

@SunMarc
Copy link
Member

SunMarc commented Aug 4, 2025

TP training alone should work no ?

@S1ro1
Copy link
Member Author

S1ro1 commented Aug 4, 2025

TP training alone should work no ?

Yes it should, though there are some limitations which I didn't have time to address yet (saving etc), though usage of tp only training is very limited so not a big deal IMO.

LGMT. Just to be sure, this should be safe wrt to fsdpv2 for example ? Do we handle the states
differently for these cases ? If tp is used, this will always to executed first

No, this would only cause _prepare_one to be called multiple times which becomes a no-op the 2nd time anyway.

@SunMarc SunMarc merged commit c173b4f into main Aug 5, 2025
29 checks passed
@SunMarc SunMarc deleted the fix-pure-tp-prepare branch August 5, 2025 11:07
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