MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / parse_args

Function parse_args

NLP/EMNLP2019-MAL/src/train.py:41–235  ·  view source on GitHub ↗

parse_args

()

Source from the content-addressed store, hash-verified

39from relative_model import relative_transformer, relative_fast_decode
40
41def parse_args():
42 """
43 parse_args
44 """
45 parser = argparse.ArgumentParser("Training for Transformer.")
46 parser.add_argument(
47 "--train_file_pattern",
48 type=str,
49 required=True,
50 help="The pattern to match training data files.")
51 parser.add_argument(
52 "--val_file_pattern",
53 type=str,
54 help="The pattern to match validation data files.")
55 parser.add_argument(
56 "--ckpt_path",
57 type=str,
58 help="The pattern to match training data files.")
59 parser.add_argument(
60 "--infer_batch_size",
61 type=int,
62 help="Infer batch_size")
63 parser.add_argument(
64 "--decode_alpha",
65 type=float,
66 help="decode_alpha")
67 parser.add_argument(
68 "--beam_size",
69 type=int,
70 help="Infer beam_size")
71 parser.add_argument(
72 "--use_token_batch",
73 type=ast.literal_eval,
74 default=True,
75 help="The flag indicating whether to "
76 "produce batch data according to token number.")
77 parser.add_argument(
78 "--batch_size",
79 type=int,
80 default=4096,
81 help="The number of sequences contained in a mini-batch, or the maximum "
82 "number of tokens (include paddings) contained in a mini-batch. Note "
83 "that this represents the number on single device and the actual batch "
84 "size for multi-devices will multiply the device number.")
85 parser.add_argument(
86 "--pool_size",
87 type=int,
88 default=200000,
89 help="The buffer size to pool data.")
90 parser.add_argument(
91 "--num_threads",
92 type=int,
93 default=2,
94 help="The number of threads which executor use.")
95 parser.add_argument(
96 "--use_fp16",
97 type=ast.literal_eval,
98 default=True,

Callers 1

train.pyFile · 0.70

Calls 5

load_dictMethod · 0.80
merge_cfg_from_listFunction · 0.70
decodeMethod · 0.45
encodeMethod · 0.45
parse_argsMethod · 0.45

Tested by

no test coverage detected