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
05414425
Commit
05414425
authored
Nov 30, 2018
by
thomwolf
Browse files
add do_lower_case in examples
parent
3951c2c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
examples/extract_features.py
examples/extract_features.py
+2
-1
examples/run_classifier.py
examples/run_classifier.py
+5
-1
No files found.
examples/extract_features.py
View file @
05414425
...
...
@@ -199,6 +199,7 @@ def main():
"bert-large-uncased, bert-base-cased, bert-base-multilingual, bert-base-chinese."
)
## 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
(
"--layers"
,
default
=
"-1,-2,-3,-4"
,
type
=
str
)
parser
.
add_argument
(
"--max_seq_length"
,
default
=
128
,
type
=
int
,
help
=
"The maximum total input sequence length after WordPiece tokenization. Sequences longer "
...
...
@@ -227,7 +228,7 @@ def main():
layer_indexes
=
[
int
(
x
)
for
x
in
args
.
layers
.
split
(
","
)]
tokenizer
=
BertTokenizer
.
from_pretrained
(
args
.
bert_model
)
tokenizer
=
BertTokenizer
.
from_pretrained
(
args
.
bert_model
,
do_lower_case
=
args
.
do_lower_case
)
examples
=
read_examples
(
args
.
input_file
)
...
...
examples/run_classifier.py
View file @
05414425
...
...
@@ -376,6 +376,10 @@ def main():
default
=
False
,
action
=
'store_true'
,
help
=
"Whether to run eval on the dev set."
)
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
(
"--train_batch_size"
,
default
=
32
,
type
=
int
,
...
...
@@ -473,7 +477,7 @@ def main():
processor
=
processors
[
task_name
]()
label_list
=
processor
.
get_labels
()
tokenizer
=
BertTokenizer
.
from_pretrained
(
args
.
bert_model
)
tokenizer
=
BertTokenizer
.
from_pretrained
(
args
.
bert_model
,
do_lower_case
=
args
.
do_lower_case
)
train_examples
=
None
num_train_steps
=
None
...
...
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