Skip to content

Commit 446c974

Browse files
Darktexfacebook-github-bot
authored andcommitted
Put the model in train mode in the text classifier tutorial (#112)
Summary: Pull Request resolved: #112 PrivacyEngine wants modules to be in train mode, otherwise you may get an obscure err Reviewed By: karthikprasad Differential Revision: D25858498 fbshipit-source-id: 6247d850dd4c7aeaedc5d2265a6e45cab1c6616b
1 parent 25885e2 commit 446c974

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tutorials/building_text_classifier.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@
560560
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
561561
"model = model.to(device)\n",
562562
"\n",
563+
"# Set the model to train mode (HuggingFace models load in eval mode)\n",
564+
"model = model.train()\n"
563565
"# Define optimizer\n",
564566
"optimizer = torch.optim.AdamW(model.parameters(), lr=5e-4, eps=1e-8)"
565567
]

0 commit comments

Comments
 (0)