Repository navigation
Fix tensor leakage in discojs - #1237
Merged
Merged
Conversation
JulienVig
force-pushed
the
fix-tensor-leaks
branch
3 times, most recently
from
October 1, 2026 11:01
10cd762 to
7b599ac
Compare
JulienVig
marked this pull request as ready for review
October 1, 2026 11:02
Collaborator
Author
|
@ale18V @leonard-amsler, please have a look at the updated tensor memory mangement section DISCOJS.md. |
JulienVig
added this pull request to stack #1242
October 2, 2026 15:58
JulienVig
force-pushed
the
fix-tensor-leaks
branch
3 times, most recently
from
October 13, 2026 14:57
228f1f2 to
47bfc46
Compare
JulienVig
force-pushed
the
fix-tensor-leaks
branch
from
October 13, 2026 15:25
47bfc46 to
990e74c
Compare
JulienVig
force-pushed
the
fix-tensor-leaks
branch
2 times, most recently
from
October 13, 2026 15:32
b68268f to
28d1999
Compare
JulienVig
force-pushed
the
fix-tensor-leaks
branch
from
October 14, 2026 10:59
28d1999 to
82a79a5
Compare
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.
Refined tensory memory management (see DISCOJS.md):
model.weights,.get(i)) return tensors still owned by the object, so the caller must not dispose them.new WeightsContainer(tensors)) take ownership of the tensors passed in and dispose them in their owndispose()..clone(), not the argument itself.trainer.releaseModel()): the caller becomes the owner and the previous owner drops its reference.Refactored the code to follow these conventions and fix the tensor leaks found along the way:
byzantine,percentile_clippingandsecure_historyaggregators. Aggregators are now freed when the client closes, andmakePayloadsreturns copies instead of sharing the original tensors..dataSync()to the async.data().modelSyncand stopped calls to a model that was already freed.ModelLibraryandTestSteps.model_set.DISCOJS.md, and the examples now usetrainer.releaseModel.