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

Add batch/microbatch transforms #3703

Merged
merged 8 commits into from
Nov 11, 2024

Conversation

mvpatel2000
Copy link
Contributor

What does this PR do?

#3566 moved device transfers into the microbatch loop. This results in device transformations occurring on CPU, which can be slow as pointed out in #3699.

To remedy this, we deprecate device_transforms (which was poorly named anyways) and instead add batch_transforms and microbatch_transforms to dataspec. Batch transforms happens on CPU, and microbatch transforms happens on GPU after the device transfer.

Additionally, if users want to do batch level transforms on GPU, they can add a transform that moves to device.

@mvpatel2000
Copy link
Contributor Author

CC: @Ghelfi

@antoinebrl
Copy link
Contributor

Thanks @mvpatel2000 ! Will there be a new release following this merge? The regression introduced in 0.25.0 is a blocker for us as our trainings are 10x slower.

@mvpatel2000
Copy link
Contributor Author

Thanks @mvpatel2000 ! Will there be a new release following this merge? The regression introduced in 0.25.0 is a blocker for us as our trainings are 10x slower.

We're still figuring out when it would be released. To unblock, I recommend adding a transform that just moves batch to device.

@antoinebrl
Copy link
Contributor

To unblock, I recommend adding a transform that just moves batch to device.

Thanks! That is exactly the patch we have right now 👍

composer/core/data_spec.py Outdated Show resolved Hide resolved
composer/trainer/trainer.py Show resolved Hide resolved
Copy link
Contributor

@antoinebrl antoinebrl left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@mvpatel2000 mvpatel2000 merged commit 18da725 into mosaicml:main Nov 11, 2024
14 checks passed
@mvpatel2000 mvpatel2000 deleted the mvpatel2000/microbatch branch November 11, 2024 20:48
@Ghelfi
Copy link
Contributor

Ghelfi commented Nov 13, 2024

Thanks for quick implementation.
@mvpatel2000 given the fact that we cannot, for now, run any transform on device, it seems appropriate to trigger a release o re-enable this functionality since it is now patched.

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