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
d72e5a3a
Commit
d72e5a3a
authored
Jun 10, 2021
by
Sylvain Gugger
Browse files
Fix quality
parent
73a53265
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
examples/pytorch/token-classification/run_ner_no_trainer.py
examples/pytorch/token-classification/run_ner_no_trainer.py
+14
-8
No files found.
examples/pytorch/token-classification/run_ner_no_trainer.py
View file @
d72e5a3a
...
...
@@ -76,10 +76,16 @@ def parse_args():
"--validation_file"
,
type
=
str
,
default
=
None
,
help
=
"A csv or a json file containing the validation data."
)
parser
.
add_argument
(
"--text_column_name"
,
type
=
str
,
default
=
None
,
help
=
"The column name of text to input in the file (a csv or JSON file)."
"--text_column_name"
,
type
=
str
,
default
=
None
,
help
=
"The column name of text to input in the file (a csv or JSON file)."
,
)
parser
.
add_argument
(
"--label_column_name"
,
type
=
str
,
default
=
None
,
help
=
"The column name of label to input in the file (a csv or JSON file)."
"--label_column_name"
,
type
=
str
,
default
=
None
,
help
=
"The column name of label to input in the file (a csv or JSON file)."
,
)
parser
.
add_argument
(
"--max_length"
,
...
...
@@ -266,17 +272,17 @@ def main():
column_names
=
raw_datasets
[
"validation"
].
column_names
features
=
raw_datasets
[
"validation"
].
features
if
data_
args
.
text_column_name
is
not
None
:
text_column_name
=
data_
args
.
text_column_name
if
args
.
text_column_name
is
not
None
:
text_column_name
=
args
.
text_column_name
elif
"tokens"
in
column_names
:
text_column_name
=
"tokens"
else
:
text_column_name
=
column_names
[
0
]
if
data_
args
.
label_column_name
is
not
None
:
label_column_name
=
data_
args
.
label_column_name
elif
f
"
{
data_
args
.
task_name
}
_tags"
in
column_names
:
label_column_name
=
f
"
{
data_
args
.
task_name
}
_tags"
if
args
.
label_column_name
is
not
None
:
label_column_name
=
args
.
label_column_name
elif
f
"
{
args
.
task_name
}
_tags"
in
column_names
:
label_column_name
=
f
"
{
args
.
task_name
}
_tags"
else
:
label_column_name
=
column_names
[
1
]
...
...
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