mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-09-01 20:38:11 +00:00
fix move model to device before calculating loss
This commit is contained in:
parent
e4227c899b
commit
d2410cb0c6
@ -425,6 +425,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"torch.manual_seed(123)\n",
|
"torch.manual_seed(123)\n",
|
||||||
"model = GPTModel(GPT_CONFIG_124M)\n",
|
"model = GPTModel(GPT_CONFIG_124M)\n",
|
||||||
|
"model.to(device)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"loss = calc_loss_batch(input_batch, target_batch, model, device)\n",
|
"loss = calc_loss_batch(input_batch, target_batch, model, device)\n",
|
||||||
"loss.backward()"
|
"loss.backward()"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user