"vscode:/vscode.git/clone" did not exist on "2063287b42f3ca1fcb7957b7f9c962405a75d0dc"
Unverified Commit 501040fd authored by Hong Xu's avatar Hong Xu Committed by GitHub
Browse files

In the run_ner.py example, give the optional label arg a default value (#5326)

Otherwise, if label is not specified, the following error occurs:

	Traceback (most recent call last):
	  File "run_ner.py", line 303, in <module>
	    main()
	  File "run_ner.py", line 101, in main
	    model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]))
	  File "/home/user/anaconda3/envs/bert/lib/python3.7/site-packages/transformers/hf_argparser.py", line 159, in parse_json_file
	    obj = dtype(**inputs)
	TypeError: __init__() missing 1 required positional argument: 'labels'
parent b45e65ef
...@@ -75,7 +75,8 @@ class DataTrainingArguments: ...@@ -75,7 +75,8 @@ class DataTrainingArguments:
metadata={"help": "The input data dir. Should contain the .txt files for a CoNLL-2003-formatted task."} metadata={"help": "The input data dir. Should contain the .txt files for a CoNLL-2003-formatted task."}
) )
labels: Optional[str] = field( labels: Optional[str] = field(
metadata={"help": "Path to a file containing all labels. If not specified, CoNLL-2003 labels are used."} default=None,
metadata={"help": "Path to a file containing all labels. If not specified, CoNLL-2003 labels are used."},
) )
max_seq_length: int = field( max_seq_length: int = field(
default=128, default=128,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment