multi-GPU VAE Fix for Cosmos 3#13924
Conversation
Under sharded placement (device_map="balanced"), vae.encode() runs on the VAE's own device while the mean/inv_std buffers were pinned to x.device, causing a cross-device RuntimeError. Compute raw_mu first, then pin the normalization buffers to its device so all tensors share one device.
|
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. |
|
Thanks for your PR! This needs a bit of library-wise thinking. I'd suggest shipping the VAE fixes in this PR. We can maintain a script in our docs for the time being to show how this can be used. |
33ea463 to
9f099d4
Compare
|
Hi @atharvajoshi10, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
fix(cosmos3): pin VAE latent norm buffers to encode output device Under sharded placement (device_map="balanced"), vae.encode() runs on the VAE's own device while the mean/inv_std buffers were pinned to x.device, causing a cross-device RuntimeError. Compute raw_mu first, then pin the normalization buffers to its device so all tensors share one device. Co-authored-by: Atharva Joshi <[email protected]> Co-authored-by: Sayak Paul <[email protected]>
fix(cosmos3): pin VAE latent norm buffers to encode output device Under sharded placement (device_map="balanced"), vae.encode() runs on the VAE's own device while the mean/inv_std buffers were pinned to x.device, causing a cross-device RuntimeError. Compute raw_mu first, then pin the normalization buffers to its device so all tensors share one device. Co-authored-by: Atharva Joshi <[email protected]> Co-authored-by: Sayak Paul <[email protected]>
multi-GPU VAE fix
What this does
Fixes a cross-device error that surfaced when running Cosmos 3 under sharded (
device_map) placement.Fix VAE latent-norm device mismatch under sharded placement
Under
device_map="balanced",vae.encode()runs on the VAE's own device while themean/inv_stdnormalization buffers were pinned tox.device, causing a cross-deviceRuntimeError. Now computesraw_mufirst and pins the normalization buffers to its device so all tensors share one device.