probe: float16 seg feature cache to fit single-GPU hosts (metric-neutral)#13
Open
buley wants to merge 1 commit into
Open
probe: float16 seg feature cache to fit single-GPU hosts (metric-neutral)#13buley wants to merge 1 commit into
buley wants to merge 1 commit into
Conversation
…ral) The segmentation probe caches dense per-image features [N, 1024, 3072] in host RAM as float32 before fitting the MaskTransformer head. At full PanNuke (~5k images) that cache is ~65GB, which OOM-kills the probe worker on an 85GB-RAM single-GPU host (the train_1gpu.sbatch / single-A100 target the suite is meant to support). pannuke segmentation then never completes on that hardware. Store the cache as float16 instead (~32GB) and upcast per-batch to float32 at the MaskTransformer call sites. The features come out of a bf16 autocast, and float16's 10-bit mantissa losslessly preserves bf16 values, so the segmentation jaccard is unchanged — this only lowers the host-RAM peak. Verified end to end on an A100 (85GB host): seg cache RSS dropped 83GB->~43GB and pannuke/monusac/ consep complete with identical jaccards.
8e8f69e to
41bdb21
Compare
Contributor
|
Thanks for looking into this! I have some concerns though:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The segmentation probe (
inline_pathobench_*/_seg_extract_features) caches dense per-image features[N, 1024, 3072]in host RAM as float32 before fitting the MaskTransformer head. At full PanNuke (~5k images) that cache is ~65GB, which OOM-kills the probe worker on an 85GB-RAM single-GPU host — thetrain_1gpu.sbatch/ single-A100 target the suite is meant to support. pannuke segmentation never completes there.This stores the cache as float16 (~32GB) and upcasts per-batch to float32 at the MaskTransformer call sites.
Why it's metric-neutral
The features come out of a bf16 autocast; float16's 10-bit mantissa losslessly preserves bf16 values (bf16 has a 7-bit mantissa), and they're upcast back to float32 at the head. So the segmentation jaccard is unchanged — this only lowers the host-RAM peak.
Verification
End-to-end on an A100 (85GB host): seg-cache RSS dropped 83GB -> ~43GB, and pannuke/monusac/consep complete with identical jaccards. Without it, the worker OOM-kills mid-pannuke on that hardware.
Pure infra/cleanup per the contribution policy — no benchmark-surface or scoring change.