Broadcast tensor shape in distributed offload caches - #857
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Require one maintainer reviewAll PRs must have at least one approving review from a maintainer before merging.
|
brian-dellabetta
left a comment
There was a problem hiding this comment.
LGTM, comment is helpful!
|
The quality checks have failed. Please run |
The distributed CPU and disk caches only reconciled dtype divergence between ranks; the non-source (meta-init) rank kept its own tensor shape. For tied/multimodal models, transformers can meta-initialize a parameter with a different shape than the checkpoint tensor materialized on the source rank. In the CPU cache, `Tensor.set_()` then lays the non-source rank's larger layout over the source's smaller shared storage and raises `setStorage: ... out of bounds`. Broadcast the source tensor's shape alongside its dtype and rebuild the non-source tensor to match both before pointing it at the shared storage (CPU) or recording the meta placeholder (disk). Add `test_load_dist_no_missing_keys` covering multimodal, tied, and untied models under `load_offloaded_model` in a 2-rank setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Brian Dellabetta <brian-dellabetta@users.noreply.github.com> Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
3a24b9d to
0e79204
Compare
|
The quality checks have failed. Please run |
Purpose
The distributed CPU and disk offload caches only reconciled dtype divergence between ranks; the non-source (meta-init) rank kept its own tensor shape. For tied/multimodal models, transformers can meta-initialize a parameter with a different shape than the checkpoint tensor materialized on the source rank.
In the CPU cache this makes
Tensor.set_()lay the non-source rank's larger layout over the source's smaller shared storage:Changes
shapealongside itsdtypeinDistributedCPUCache.offloadandDistributedDiskCache.offload.test_load_dist_no_missing_keys, covering multimodal, tied, and untied models underload_offloaded_modelin a 2-rank (world_size=2) setup.Testing
test_load_dist_no_missing_keyspasses on 2 GPUs across all four models listed in #856. Without this change, the multimodal/tiedgemma-4-1B-0.8B-tinycase fails with thesetStorageerror above.https://github.com/neuralmagic/llm-compressor-testing/actions/runs/33012761751