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
d0efbd3c
Commit
d0efbd3c
authored
Jul 09, 2019
by
thomwolf
Browse files
update sequencesummary module
parent
d5481cbe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
.coveragerc
.coveragerc
+1
-0
examples/test_examples.py
examples/test_examples.py
+1
-1
pytorch_transformers/modeling_gpt2.py
pytorch_transformers/modeling_gpt2.py
+6
-0
pytorch_transformers/modeling_openai.py
pytorch_transformers/modeling_openai.py
+6
-0
No files found.
.coveragerc
View file @
d0efbd3c
...
@@ -3,6 +3,7 @@ source=pytorch_transformers
...
@@ -3,6 +3,7 @@ source=pytorch_transformers
omit =
omit =
# skip convertion scripts from testing for now
# skip convertion scripts from testing for now
*/convert_*
*/convert_*
*/__main__.py
[report]
[report]
exclude_lines =
exclude_lines =
pragma: no cover
pragma: no cover
...
...
examples/test_examples.py
View file @
d0efbd3c
...
@@ -48,7 +48,7 @@ class ExamplesTests(unittest.TestCase):
...
@@ -48,7 +48,7 @@ class ExamplesTests(unittest.TestCase):
testargs
=
[
"run_glue.py"
,
"--data_dir=./examples/tests_samples/MRPC/"
,
testargs
=
[
"run_glue.py"
,
"--data_dir=./examples/tests_samples/MRPC/"
,
"--task_name=mrpc"
,
"--do_train"
,
"--do_eval"
,
"--output_dir=./examples/tests_samples/temp_dir"
,
"--task_name=mrpc"
,
"--do_train"
,
"--do_eval"
,
"--output_dir=./examples/tests_samples/temp_dir"
,
"--train_batch_size=4"
,
"--eval_batch_size=2"
,
"--num_train_epochs=2.0"
,
"--overwrite_output_dir"
]
"--train_batch_size=4"
,
"--eval_batch_size=2"
,
"--num_train_epochs=2.0"
,
"--overwrite_output_dir"
]
model_name
=
"--model_name=
xlnet-large-
cased"
model_name
=
"--model_name=
bert-base-un
cased"
with
patch
.
object
(
sys
,
'argv'
,
testargs
+
[
model_name
]):
with
patch
.
object
(
sys
,
'argv'
,
testargs
+
[
model_name
]):
result
=
run_glue
.
main
()
result
=
run_glue
.
main
()
for
value
in
result
.
values
():
for
value
in
result
.
values
():
...
...
pytorch_transformers/modeling_gpt2.py
View file @
d0efbd3c
...
@@ -119,9 +119,12 @@ class GPT2Config(PretrainedConfig):
...
@@ -119,9 +119,12 @@ class GPT2Config(PretrainedConfig):
layer_norm_epsilon
=
1e-5
,
layer_norm_epsilon
=
1e-5
,
initializer_range
=
0.02
,
initializer_range
=
0.02
,
predict_special_tokens
=
True
,
predict_special_tokens
=
True
,
num_labels
=
1
,
summary_type
=
'token_ids'
,
summary_type
=
'token_ids'
,
summary_use_proj
=
True
,
summary_use_proj
=
True
,
summary_activation
=
None
,
summary_activation
=
None
,
summary_proj_to_labels
=
True
,
summary_first_dropout
=
0.1
,
summary_first_dropout
=
0.1
,
**
kwargs
**
kwargs
):
):
...
@@ -168,10 +171,13 @@ class GPT2Config(PretrainedConfig):
...
@@ -168,10 +171,13 @@ class GPT2Config(PretrainedConfig):
self
.
layer_norm_epsilon
=
layer_norm_epsilon
self
.
layer_norm_epsilon
=
layer_norm_epsilon
self
.
initializer_range
=
initializer_range
self
.
initializer_range
=
initializer_range
self
.
predict_special_tokens
=
predict_special_tokens
self
.
predict_special_tokens
=
predict_special_tokens
self
.
num_labels
=
num_labels
self
.
summary_type
=
summary_type
self
.
summary_type
=
summary_type
self
.
summary_use_proj
=
summary_use_proj
self
.
summary_use_proj
=
summary_use_proj
self
.
summary_activation
=
summary_activation
self
.
summary_activation
=
summary_activation
self
.
summary_first_dropout
=
summary_first_dropout
self
.
summary_first_dropout
=
summary_first_dropout
self
.
summary_proj_to_labels
=
summary_proj_to_labels
else
:
else
:
raise
ValueError
(
raise
ValueError
(
"First argument must be either a vocabulary size (int)"
"First argument must be either a vocabulary size (int)"
...
...
pytorch_transformers/modeling_openai.py
View file @
d0efbd3c
...
@@ -147,9 +147,12 @@ class OpenAIGPTConfig(PretrainedConfig):
...
@@ -147,9 +147,12 @@ class OpenAIGPTConfig(PretrainedConfig):
layer_norm_epsilon
=
1e-5
,
layer_norm_epsilon
=
1e-5
,
initializer_range
=
0.02
,
initializer_range
=
0.02
,
predict_special_tokens
=
True
,
predict_special_tokens
=
True
,
num_labels
=
1
,
summary_type
=
'token_ids'
,
summary_type
=
'token_ids'
,
summary_use_proj
=
True
,
summary_use_proj
=
True
,
summary_activation
=
None
,
summary_activation
=
None
,
summary_proj_to_labels
=
True
,
summary_first_dropout
=
0.1
,
summary_first_dropout
=
0.1
,
**
kwargs
**
kwargs
):
):
...
@@ -199,10 +202,13 @@ class OpenAIGPTConfig(PretrainedConfig):
...
@@ -199,10 +202,13 @@ class OpenAIGPTConfig(PretrainedConfig):
self
.
layer_norm_epsilon
=
layer_norm_epsilon
self
.
layer_norm_epsilon
=
layer_norm_epsilon
self
.
initializer_range
=
initializer_range
self
.
initializer_range
=
initializer_range
self
.
predict_special_tokens
=
predict_special_tokens
self
.
predict_special_tokens
=
predict_special_tokens
self
.
num_labels
=
num_labels
self
.
summary_type
=
summary_type
self
.
summary_type
=
summary_type
self
.
summary_use_proj
=
summary_use_proj
self
.
summary_use_proj
=
summary_use_proj
self
.
summary_activation
=
summary_activation
self
.
summary_activation
=
summary_activation
self
.
summary_first_dropout
=
summary_first_dropout
self
.
summary_first_dropout
=
summary_first_dropout
self
.
summary_proj_to_labels
=
summary_proj_to_labels
else
:
else
:
raise
ValueError
(
raise
ValueError
(
"First argument must be either a vocabulary size (int)"
"First argument must be either a vocabulary size (int)"
...
...
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