You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Sophia neural network training documentation example
Addresses issue #937 by fixing the loss function in the Sophia training example to properly handle DataLoader batches.
The issue was in the loss function which was trying to access `data[1]` and `data[2]` directly on a DataLoader object, which is not indexable in that way. The corrected version:
- Changes parameter name from `data` to `batch` for clarity
- Properly unpacks the batch using `x_batch, y_batch = batch`
- Uses the unpacked batch data correctly in the loss computation
This follows the same pattern as the working minibatch tutorial and allows users to run the example outside of the optimization loop, as requested in the issue.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
0 commit comments