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
c9fd3505
Commit
c9fd3505
authored
Jan 07, 2019
by
thomwolf
Browse files
remove default when action is store_true in arguments
parent
e048c7f1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
22 deletions
+4
-22
examples/extract_features.py
examples/extract_features.py
+1
-2
examples/run_classifier.py
examples/run_classifier.py
+0
-5
examples/run_lm_finetuning.py
examples/run_lm_finetuning.py
+0
-4
examples/run_squad.py
examples/run_squad.py
+3
-6
examples/run_swag.py
examples/run_swag.py
+0
-5
No files found.
examples/extract_features.py
View file @
c9fd3505
...
@@ -199,7 +199,7 @@ def main():
...
@@ -199,7 +199,7 @@ def main():
"bert-large-uncased, bert-base-cased, bert-base-multilingual, bert-base-chinese."
)
"bert-large-uncased, bert-base-cased, bert-base-multilingual, bert-base-chinese."
)
## Other parameters
## Other parameters
parser
.
add_argument
(
"--do_lower_case"
,
default
=
False
,
action
=
'store_true'
,
help
=
"Set this flag if you are using an uncased model."
)
parser
.
add_argument
(
"--do_lower_case"
,
action
=
'store_true'
,
help
=
"Set this flag if you are using an uncased model."
)
parser
.
add_argument
(
"--layers"
,
default
=
"-1,-2,-3,-4"
,
type
=
str
)
parser
.
add_argument
(
"--layers"
,
default
=
"-1,-2,-3,-4"
,
type
=
str
)
parser
.
add_argument
(
"--max_seq_length"
,
default
=
128
,
type
=
int
,
parser
.
add_argument
(
"--max_seq_length"
,
default
=
128
,
type
=
int
,
help
=
"The maximum total input sequence length after WordPiece tokenization. Sequences longer "
help
=
"The maximum total input sequence length after WordPiece tokenization. Sequences longer "
...
@@ -210,7 +210,6 @@ def main():
...
@@ -210,7 +210,6 @@ def main():
default
=-
1
,
default
=-
1
,
help
=
"local_rank for distributed training on gpus"
)
help
=
"local_rank for distributed training on gpus"
)
parser
.
add_argument
(
"--no_cuda"
,
parser
.
add_argument
(
"--no_cuda"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether not to use CUDA when available"
)
help
=
"Whether not to use CUDA when available"
)
...
...
examples/run_classifier.py
View file @
c9fd3505
...
@@ -333,15 +333,12 @@ def main():
...
@@ -333,15 +333,12 @@ def main():
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"than this will be padded."
)
"than this will be padded."
)
parser
.
add_argument
(
"--do_train"
,
parser
.
add_argument
(
"--do_train"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--do_eval"
,
parser
.
add_argument
(
"--do_eval"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to run eval on the dev set."
)
help
=
"Whether to run eval on the dev set."
)
parser
.
add_argument
(
"--do_lower_case"
,
parser
.
add_argument
(
"--do_lower_case"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Set this flag if you are using an uncased model."
)
help
=
"Set this flag if you are using an uncased model."
)
parser
.
add_argument
(
"--train_batch_size"
,
parser
.
add_argument
(
"--train_batch_size"
,
...
@@ -366,7 +363,6 @@ def main():
...
@@ -366,7 +363,6 @@ def main():
help
=
"Proportion of training to perform linear learning rate warmup for. "
help
=
"Proportion of training to perform linear learning rate warmup for. "
"E.g., 0.1 = 10%% of training."
)
"E.g., 0.1 = 10%% of training."
)
parser
.
add_argument
(
"--no_cuda"
,
parser
.
add_argument
(
"--no_cuda"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether not to use CUDA when available"
)
help
=
"Whether not to use CUDA when available"
)
parser
.
add_argument
(
"--local_rank"
,
parser
.
add_argument
(
"--local_rank"
,
...
@@ -382,7 +378,6 @@ def main():
...
@@ -382,7 +378,6 @@ def main():
default
=
1
,
default
=
1
,
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
parser
.
add_argument
(
'--fp16'
,
parser
.
add_argument
(
'--fp16'
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
parser
.
add_argument
(
'--loss_scale'
,
parser
.
add_argument
(
'--loss_scale'
,
...
...
examples/run_lm_finetuning.py
View file @
c9fd3505
...
@@ -432,7 +432,6 @@ def main():
...
@@ -432,7 +432,6 @@ def main():
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"than this will be padded."
)
"than this will be padded."
)
parser
.
add_argument
(
"--do_train"
,
parser
.
add_argument
(
"--do_train"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--train_batch_size"
,
parser
.
add_argument
(
"--train_batch_size"
,
...
@@ -457,11 +456,9 @@ def main():
...
@@ -457,11 +456,9 @@ def main():
help
=
"Proportion of training to perform linear learning rate warmup for. "
help
=
"Proportion of training to perform linear learning rate warmup for. "
"E.g., 0.1 = 10%% of training."
)
"E.g., 0.1 = 10%% of training."
)
parser
.
add_argument
(
"--no_cuda"
,
parser
.
add_argument
(
"--no_cuda"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether not to use CUDA when available"
)
help
=
"Whether not to use CUDA when available"
)
parser
.
add_argument
(
"--on_memory"
,
parser
.
add_argument
(
"--on_memory"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to load train samples into memory or use disk"
)
help
=
"Whether to load train samples into memory or use disk"
)
parser
.
add_argument
(
"--local_rank"
,
parser
.
add_argument
(
"--local_rank"
,
...
@@ -477,7 +474,6 @@ def main():
...
@@ -477,7 +474,6 @@ def main():
default
=
1
,
default
=
1
,
help
=
"Number of updates steps to accumualte before performing a backward/update pass."
)
help
=
"Number of updates steps to accumualte before performing a backward/update pass."
)
parser
.
add_argument
(
'--fp16'
,
parser
.
add_argument
(
'--fp16'
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
parser
.
add_argument
(
'--loss_scale'
,
parser
.
add_argument
(
'--loss_scale'
,
...
...
examples/run_squad.py
View file @
c9fd3505
...
@@ -698,8 +698,8 @@ def main():
...
@@ -698,8 +698,8 @@ def main():
parser
.
add_argument
(
"--max_query_length"
,
default
=
64
,
type
=
int
,
parser
.
add_argument
(
"--max_query_length"
,
default
=
64
,
type
=
int
,
help
=
"The maximum number of tokens for the question. Questions longer than this will "
help
=
"The maximum number of tokens for the question. Questions longer than this will "
"be truncated to this length."
)
"be truncated to this length."
)
parser
.
add_argument
(
"--do_train"
,
default
=
False
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--do_train"
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--do_predict"
,
default
=
False
,
action
=
'store_true'
,
help
=
"Whether to run eval on the dev set."
)
parser
.
add_argument
(
"--do_predict"
,
action
=
'store_true'
,
help
=
"Whether to run eval on the dev set."
)
parser
.
add_argument
(
"--train_batch_size"
,
default
=
32
,
type
=
int
,
help
=
"Total batch size for training."
)
parser
.
add_argument
(
"--train_batch_size"
,
default
=
32
,
type
=
int
,
help
=
"Total batch size for training."
)
parser
.
add_argument
(
"--predict_batch_size"
,
default
=
8
,
type
=
int
,
help
=
"Total batch size for predictions."
)
parser
.
add_argument
(
"--predict_batch_size"
,
default
=
8
,
type
=
int
,
help
=
"Total batch size for predictions."
)
parser
.
add_argument
(
"--learning_rate"
,
default
=
5e-5
,
type
=
float
,
help
=
"The initial learning rate for Adam."
)
parser
.
add_argument
(
"--learning_rate"
,
default
=
5e-5
,
type
=
float
,
help
=
"The initial learning rate for Adam."
)
...
@@ -714,11 +714,10 @@ def main():
...
@@ -714,11 +714,10 @@ def main():
parser
.
add_argument
(
"--max_answer_length"
,
default
=
30
,
type
=
int
,
parser
.
add_argument
(
"--max_answer_length"
,
default
=
30
,
type
=
int
,
help
=
"The maximum length of an answer that can be generated. This is needed because the start "
help
=
"The maximum length of an answer that can be generated. This is needed because the start "
"and end predictions are not conditioned on one another."
)
"and end predictions are not conditioned on one another."
)
parser
.
add_argument
(
"--verbose_logging"
,
default
=
False
,
action
=
'store_true'
,
parser
.
add_argument
(
"--verbose_logging"
,
action
=
'store_true'
,
help
=
"If true, all of the warnings related to data processing will be printed. "
help
=
"If true, all of the warnings related to data processing will be printed. "
"A number of warnings are expected for a normal SQuAD evaluation."
)
"A number of warnings are expected for a normal SQuAD evaluation."
)
parser
.
add_argument
(
"--no_cuda"
,
parser
.
add_argument
(
"--no_cuda"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether not to use CUDA when available"
)
help
=
"Whether not to use CUDA when available"
)
parser
.
add_argument
(
'--seed'
,
parser
.
add_argument
(
'--seed'
,
...
@@ -730,7 +729,6 @@ def main():
...
@@ -730,7 +729,6 @@ def main():
default
=
1
,
default
=
1
,
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
parser
.
add_argument
(
"--do_lower_case"
,
parser
.
add_argument
(
"--do_lower_case"
,
default
=
True
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to lower case the input text. True for uncased models, False for cased models."
)
help
=
"Whether to lower case the input text. True for uncased models, False for cased models."
)
parser
.
add_argument
(
"--local_rank"
,
parser
.
add_argument
(
"--local_rank"
,
...
@@ -738,7 +736,6 @@ def main():
...
@@ -738,7 +736,6 @@ def main():
default
=-
1
,
default
=-
1
,
help
=
"local_rank for distributed training on gpus"
)
help
=
"local_rank for distributed training on gpus"
)
parser
.
add_argument
(
'--fp16'
,
parser
.
add_argument
(
'--fp16'
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
parser
.
add_argument
(
'--loss_scale'
,
parser
.
add_argument
(
'--loss_scale'
,
...
...
examples/run_swag.py
View file @
c9fd3505
...
@@ -265,15 +265,12 @@ def main():
...
@@ -265,15 +265,12 @@ def main():
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"Sequences longer than this will be truncated, and sequences shorter
\n
"
"than this will be padded."
)
"than this will be padded."
)
parser
.
add_argument
(
"--do_train"
,
parser
.
add_argument
(
"--do_train"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to run training."
)
help
=
"Whether to run training."
)
parser
.
add_argument
(
"--do_eval"
,
parser
.
add_argument
(
"--do_eval"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to run eval on the dev set."
)
help
=
"Whether to run eval on the dev set."
)
parser
.
add_argument
(
"--do_lower_case"
,
parser
.
add_argument
(
"--do_lower_case"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Set this flag if you are using an uncased model."
)
help
=
"Set this flag if you are using an uncased model."
)
parser
.
add_argument
(
"--train_batch_size"
,
parser
.
add_argument
(
"--train_batch_size"
,
...
@@ -298,7 +295,6 @@ def main():
...
@@ -298,7 +295,6 @@ def main():
help
=
"Proportion of training to perform linear learning rate warmup for. "
help
=
"Proportion of training to perform linear learning rate warmup for. "
"E.g., 0.1 = 10%% of training."
)
"E.g., 0.1 = 10%% of training."
)
parser
.
add_argument
(
"--no_cuda"
,
parser
.
add_argument
(
"--no_cuda"
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether not to use CUDA when available"
)
help
=
"Whether not to use CUDA when available"
)
parser
.
add_argument
(
"--local_rank"
,
parser
.
add_argument
(
"--local_rank"
,
...
@@ -314,7 +310,6 @@ def main():
...
@@ -314,7 +310,6 @@ def main():
default
=
1
,
default
=
1
,
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
help
=
"Number of updates steps to accumulate before performing a backward/update pass."
)
parser
.
add_argument
(
'--fp16'
,
parser
.
add_argument
(
'--fp16'
,
default
=
False
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
help
=
"Whether to use 16-bit float precision instead of 32-bit"
)
parser
.
add_argument
(
'--loss_scale'
,
parser
.
add_argument
(
'--loss_scale'
,
...
...
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