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

Update auto wrap policy and remove duplicate load in trainer.fit #175

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

MattIrv
Copy link
Collaborator

@MattIrv MattIrv commented Nov 4, 2024

This updates the benchmark to use the FSDP wrap policy defined in https://lightning.ai/docs/pytorch/stable/advanced/model_parallel/fsdp.html#identify-large-layers.

Testing on a machine with 4 GPUs, before this change I get a CUDA OOM at a certain number of parameters for my model, and after the change I do not.

I also removed the checkpoint restore path from the call to trainer.fit during load since this was making the trainer restore from that checkpoint an extra time, which is time consuming, and also explicitly deleting trainer/strategy/model prior to resetting them in case it helps prevent memory leaks.

@MattIrv MattIrv requested a review from a team as a code owner November 4, 2024 17:06
@MattIrv MattIrv enabled auto-merge (squash) November 4, 2024 19:11
@MattIrv MattIrv merged commit 7195b58 into main Nov 4, 2024
5 checks passed
@MattIrv MattIrv deleted the mirvine/fsdp5 branch November 4, 2024 19:22
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.

4 participants