_null_context in train.py is fragile and confusing #18
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
train.py:185-194uses a convoluted conditional for the autocast context:The
torch.no_grad() if Falseis dead code._null_context.__enter__returnsNone, which works but is confusing. If someone accidentally changes the condition, this could silently drop gradients.Impact
torch.no_grad()if the condition is changedAction needed
Replace with a clean, explicit context manager:
Files
tergent/train.py:185-194