| 410 | |
| 411 | |
| 412 | def _add_distributed_args(parser): |
| 413 | group = parser.add_argument_group(title='mixed precision') |
| 414 | |
| 415 | group.add_argument('--model-parallel-size', type=int, default=1, |
| 416 | help='Size of the model parallel.') |
| 417 | group.add_argument('--distributed-backend', default='nccl', |
| 418 | choices=['nccl', 'gloo'], |
| 419 | help='Which backend to use for distributed training.') |
| 420 | group.add_argument('--DDP-impl', default='local', |
| 421 | choices=['local', 'torch'], |
| 422 | help='which DistributedDataParallel implementation ' |
| 423 | 'to use.') |
| 424 | group.add_argument('--local_rank', type=int, default=None, |
| 425 | help='local rank passed from distributed launcher.') |
| 426 | group.add_argument('--lazy-mpu-init', type=bool, required=False, |
| 427 | help='If set to True, initialize_megatron() skips DDP initialization' |
| 428 | ' and returns function to complete it instead.' |
| 429 | 'Also turns on --use-cpu-initialization flag.' |
| 430 | 'This is for external DDP manager.' ) |
| 431 | group.add_argument('--use-cpu-initialization', action='store_true', |
| 432 | help='If set, affine parallel weights initialization uses CPU' ) |
| 433 | return parser |
| 434 | |
| 435 | |
| 436 | def _add_validation_args(parser): |