MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / get_argument_parser

Function get_argument_parser

BingBertSquad/utils.py:10–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8SUMMARY_WRITER_DIR_NAME = 'runs'
9
10def get_argument_parser():
11 parser = argparse.ArgumentParser()
12
13 # Required parameters
14 parser.add_argument("--bert_model", default=None, type=str, required=True,
15 help="Bert pre-trained model selected in the list: bert-base-uncased, "
16 "bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, "
17 "bert-base-multilingual-cased, bert-base-chinese.")
18 parser.add_argument("--output_dir", default=None, type=str, required=True,
19 help="The output directory where the model checkpoints and predictions will be written.")
20
21 # Other parameters
22 parser.add_argument("--train_file", default=None, type=str, help="SQuAD json for training. E.g., train-v1.1.json")
23 parser.add_argument("--predict_file", default=None, type=str,
24 help="SQuAD json for predictions. E.g., dev-v1.1.json or test-v1.1.json")
25 parser.add_argument("--max_seq_length", default=384, type=int,
26 help="The maximum total input sequence length after WordPiece tokenization. Sequences "
27 "longer than this will be truncated, and sequences shorter than this will be padded.")
28 parser.add_argument("--doc_stride", default=128, type=int,
29 help="When splitting up a long document into chunks, how much stride to take between chunks.")
30 parser.add_argument("--max_query_length", default=64, type=int,
31 help="The maximum number of tokens for the question. Questions longer than this will "
32 "be truncated to this length.")
33 parser.add_argument("--do_train", action='store_true', help="Whether to run training.")
34 parser.add_argument("--do_predict", action='store_true', help="Whether to run eval on the dev set.")
35 parser.add_argument("--train_batch_size", default=32, type=int, help="Total batch size for training.")
36 parser.add_argument("--predict_batch_size", default=8, type=int, help="Total batch size for predictions.")
37 parser.add_argument("--learning_rate", default=5e-5, type=float, help="The initial learning rate for Adam.")
38 parser.add_argument("--num_train_epochs", default=3.0, type=float,
39 help="Total number of training epochs to perform.")
40 parser.add_argument("--warmup_proportion", default=0.1, type=float,
41 help="Proportion of training to perform linear learning rate warmup for. E.g., 0.1 = 10% "
42 "of training.")
43 parser.add_argument("--n_best_size", default=20, type=int,
44 help="The total number of n-best predictions to generate in the nbest_predictions.json "
45 "output file.")
46 parser.add_argument("--max_answer_length", default=30, type=int,
47 help="The maximum length of an answer that can be generated. This is needed because the start "
48 "and end predictions are not conditioned on one another.")
49 parser.add_argument("--verbose_logging", action='store_true',
50 help="If true, all of the warnings related to data processing will be printed. "
51 "A number of warnings are expected for a normal SQuAD evaluation.")
52 parser.add_argument("--no_cuda",
53 action='store_true',
54 help="Whether not to use CUDA when available")
55 parser.add_argument('--seed',
56 type=int,
57 default=42,
58 help="random seed for initialization")
59 parser.add_argument('--gradient_accumulation_steps',
60 type=int,
61 default=1,
62 help="Number of updates steps to accumulate before performing a backward/update pass.")
63 parser.add_argument("--do_lower_case",
64 action='store_true',
65 help="Whether to lower case the input text. True for uncased models, False for cased models.")
66 parser.add_argument("--local_rank",
67 type=int,

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected