Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
0b7a20c6
Commit
0b7a20c6
authored
Nov 04, 2018
by
thomwolf
Browse files
add tqdm, clean up logging
parent
d4e3cf35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
4 deletions
+2
-4
modeling.py
modeling.py
+0
-2
run_squad.py
run_squad.py
+2
-2
No files found.
modeling.py
View file @
0b7a20c6
...
...
@@ -435,7 +435,6 @@ class BertForSequenceClassification(nn.Module):
def
init_weights
(
m
):
if
isinstance
(
m
,
(
nn
.
Linear
,
nn
.
Embedding
)):
print
(
"Initializing {}"
.
format
(
m
))
# Slight difference here with the TF version which uses truncated_normal
# cf https://github.com/pytorch/pytorch/pull/5617
m
.
weight
.
data
.
normal_
(
config
.
initializer_range
)
...
...
@@ -481,7 +480,6 @@ class BertForQuestionAnswering(nn.Module):
def
init_weights
(
m
):
if
isinstance
(
m
,
(
nn
.
Linear
,
nn
.
Embedding
)):
print
(
"Initializing {}"
.
format
(
m
))
# Slight difference here with the TF version which uses truncated_normal for initialization
# cf https://github.com/pytorch/pytorch/pull/5617
m
.
weight
.
data
.
normal_
(
config
.
initializer_range
)
...
...
run_squad.py
View file @
0b7a20c6
...
...
@@ -912,9 +912,9 @@ def main():
model
.
eval
()
all_results
=
[]
logger
.
info
(
"Start eva
u
lating"
)
logger
.
info
(
"Start eval
u
ating"
)
#for input_ids, input_mask, segment_ids, label_ids, example_index in eval_dataloader:
for
input_ids
,
input_mask
,
segment_ids
,
example_index
in
eval_dataloader
:
for
input_ids
,
input_mask
,
segment_ids
,
example_index
in
tqdm
(
eval_dataloader
,
descr
=
"Evaluating"
)
:
if
len
(
all_results
)
%
1000
==
0
:
logger
.
info
(
"Processing example: %d"
%
(
len
(
all_results
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment