MCPcopy Create free account
hub / github.com/huggingface/transformers / add_generic_args

Function add_generic_args

examples/lightning_base.py:235–273  ·  view source on GitHub ↗
(parser, root_dir)

Source from the content-addressed store, hash-verified

233
234
235def add_generic_args(parser, root_dir) -> None:
236 # TODO(SS): allow all pl args? parser = pl.Trainer.add_argparse_args(parser)
237 parser.add_argument(
238 "--output_dir",
239 default=None,
240 type=str,
241 required=True,
242 help="The output directory where the model predictions and checkpoints will be written.",
243 )
244
245 parser.add_argument(
246 "--fp16",
247 action="store_true",
248 help="Whether to use 16-bit (mixed) precision (through NVIDIA apex) instead of 32-bit",
249 )
250
251 parser.add_argument(
252 "--fp16_opt_level",
253 type=str,
254 default="O1",
255 help="For fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']."
256 "See details at https://nvidia.github.io/apex/amp.html",
257 )
258 parser.add_argument("--fast_dev_run", action="store_true")
259 parser.add_argument("--gpus", type=int, default=1)
260 parser.add_argument("--n_tpu_cores", type=int, default=0)
261 parser.add_argument("--max_grad_norm", default=1.0, type=float, help="Max gradient norm.")
262 parser.add_argument("--do_train", action="store_true", help="Whether to run training.")
263 parser.add_argument("--do_predict", action="store_true", help="Whether to run predictions on the test set.")
264 parser.add_argument(
265 "--gradient_accumulation_steps",
266 type=int,
267 default=1,
268 help="Number of updates steps to accumulate before performing a backward/update pass.",
269 )
270
271 parser.add_argument("--seed", type=int, default=42, help="random seed for initialization")
272 parser.add_argument("--resume_from_checkpoint", type=str, default=None)
273 parser.add_argument("--val_check_interval", default=1.0, type=float)
274
275
276def generic_train(

Callers 3

run_pl_ner.pyFile · 0.90
run_pl_glue.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected