Repository navigation
Fix partial GPU upload cleanup after OOM - #41
Merged
dev-rinchin merged 1 commit intoNov 9, 2026
Merged
dev-rinchin merged 1 commit into
dev-rinchin merged 1 commit into
Conversation
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.
An exception partway through
Ensemble.to_device()can leave live CuPy arrays in the trees while_on_deviceremainsFalse. Bothto_cpu()and pickle's__getstate__()then skip cleanup, so retaining the model also retains its GPU allocations.Roll back failed uploads through
to_cpu()and re-raise the transfer error. Maketo_cpu()handle mixed CPU/GPU state independently of the flag, including a NumPybase_scoreand an uninitialized ensemble. Preserve CPU-only export and serialization when CuPy is unavailable.Validation:
base_scoreallocation, with compact/debug trees and default/non-default CUDA streams.Tested on Linux, Python 3.12, CuPy 14.2.0, CUDA runtime 12.9, and an RTX 5090 32 GB. The bounded pools reproduce OOM without exhausting the device. Cached pool blocks are left to CuPy's normal allocator policy; the regression checks that the model releases live allocations.