Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
47a7d4ec
Commit
47a7d4ec
authored
Nov 17, 2018
by
thomwolf
Browse files
update examples from master
parents
c8cba677
02173a1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
README.md
README.md
+1
-1
examples/run_classifier.py
examples/run_classifier.py
+8
-5
examples/run_squad.py
examples/run_squad.py
+2
-0
No files found.
README.md
View file @
47a7d4ec
...
...
@@ -395,7 +395,7 @@ python run_squad.py \
--num_train_epochs
2.0
\
--max_seq_length
384
\
--doc_stride
128
\
--output_dir
..
/debug_squad/
--output_dir
/tmp
/debug_squad/
```
Training with the previous hyper-parameters gave us the following results:
...
...
examples/run_classifier.py
View file @
47a7d4ec
...
...
@@ -327,11 +327,14 @@ def set_optimizer_params_grad(named_params_optimizer, named_params_model, test_n
if
name_opti
!=
name_model
:
logger
.
error
(
"name_opti != name_model: {} {}"
.
format
(
name_opti
,
name_model
))
raise
ValueError
if
test_nan
and
torch
.
isnan
(
param_model
.
grad
).
sum
()
>
0
:
is_nan
=
True
if
param_opti
.
grad
is
None
:
param_opti
.
grad
=
torch
.
nn
.
Parameter
(
param_opti
.
data
.
new
().
resize_
(
*
param_opti
.
data
.
size
()))
param_opti
.
grad
.
data
.
copy_
(
param_model
.
grad
.
data
)
if
param_model
.
grad
is
not
None
:
if
test_nan
and
torch
.
isnan
(
param_model
.
grad
).
sum
()
>
0
:
is_nan
=
True
if
param_opti
.
grad
is
None
:
param_opti
.
grad
=
torch
.
nn
.
Parameter
(
param_opti
.
data
.
new
().
resize_
(
*
param_opti
.
data
.
size
()))
param_opti
.
grad
.
data
.
copy_
(
param_model
.
grad
.
data
)
else
:
param_opti
.
grad
=
None
return
is_nan
def
main
():
...
...
examples/run_squad.py
View file @
47a7d4ec
...
...
@@ -693,6 +693,8 @@ def set_optimizer_params_grad(named_params_optimizer, named_params_model, test_n
if
param_opti
.
grad
is
None
:
param_opti
.
grad
=
torch
.
nn
.
Parameter
(
param_opti
.
data
.
new
().
resize_
(
*
param_opti
.
data
.
size
()))
param_opti
.
grad
.
data
.
copy_
(
param_model
.
grad
.
data
)
else
:
param_opti
.
grad
=
None
return
is_nan
def
main
():
...
...
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