[chore] fix: retain memory utility. by sayakpaul · Pull Request #9543 · huggingface/diffusers (original) (raw)
What does this PR do?
My bad that in
diffusers/src/diffusers/training_utils.py
Line 263 in534848c
def clear_objs_and_retain_memory(objs: List[Any]): |
---|
I assumed that the scope of del
would carry forward but that is not the case. So, even when we call del obj
it actually just deletes the local reference, it doesn't carry forward. So, we're better off without it and doing del
explicitly (like the changes done in this PR).
Thanks to @a-r-r-o-w for catching this. It didn't go to a release yet, so, I think this shouldn't have any issues.