diff options
| author | zhang <zch921005@126.com> | 2022-09-13 23:21:25 +0800 |
|---|---|---|
| committer | zhang <zch921005@126.com> | 2022-09-13 23:21:25 +0800 |
| commit | 2fef28a07fcc9f43455b24188987f882220c05f2 (patch) | |
| tree | 75b3808c5daec81e25b4d27cee83432855deb8ad /fine_tune/bert | |
| parent | b7e7dbcfac5bf8907d7d1e06ee6de2597a4c80f0 (diff) | |
bn train vs. eval
Diffstat (limited to 'fine_tune/bert')
| -rw-r--r-- | fine_tune/bert/tutorials/05_output.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fine_tune/bert/tutorials/05_output.py b/fine_tune/bert/tutorials/05_output.py index 1911641..a4f9db5 100644 --- a/fine_tune/bert/tutorials/05_output.py +++ b/fine_tune/bert/tutorials/05_output.py @@ -3,6 +3,7 @@ from transformers.models.bert import BertModel import torch from torch import nn +nn.BatchNorm2d() if __name__ == '__main__': @@ -14,7 +15,7 @@ if __name__ == '__main__': text = "After stealing money from the bank vault, the bank robber was seen " \ "fishing on the Mississippi river bank." - + model.eval() token_inputs = tokenizer(text, return_tensors='pt') with torch.no_grad(): outputs = model(**token_inputs) |
