mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-10-26 23:39:53 +00:00
use torch no grad for loss (#119)
This commit is contained in:
parent
98f1e97452
commit
ef2de4718e
@ -1135,6 +1135,8 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"torch.manual_seed(123) # For reproducibility due to the shuffling in the data loader\n",
|
||||
"\n",
|
||||
"with torch.no_grad(): # Disable gradient tracking for efficiency because we are not training, yet\n",
|
||||
" train_loss = calc_loss_loader(train_loader, model, device)\n",
|
||||
" val_loss = calc_loss_loader(val_loader, model, device)\n",
|
||||
"\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user