hnluo
2023-09-11 9fcb3cc06b4e324f0913d2f61b89becc2baeef1b
funasr/bin/build_trainer.py
@@ -532,11 +532,9 @@
    args = build_args(args, parser, extra_task_params)
    if args.local_rank is not None:
        args.distributed = True
        args.simple_ddp = True
        distributed = True
    else:
        args.distributed = False
        args.ngpu = 1
        distributed = False
    args.local_rank = args.local_rank if args.local_rank is not None else 0
    local_rank = args.local_rank
    if "CUDA_VISIBLE_DEVICES" in os.environ.keys():
@@ -593,6 +591,12 @@
    args.batch_type = "length"
    args.oss_bucket = None
    args.input_size = None
    if distributed:
        args.distributed = True
        args.simple_ddp = True
    else:
        args.distributed = False
        args.ngpu = 1
    if optim is not None:
        args.optim = optim
    if lr is not None:
@@ -610,6 +614,7 @@
    if batch_bins is not None:
        if args.dataset_type == "small":
            args.batch_bins = batch_bins
            args.dataset_conf["batch_conf"]["batch_size"] = batch_bins
        elif args.dataset_type == "large":
            args.dataset_conf["batch_conf"]["batch_size"] = batch_bins
        else:
@@ -627,8 +632,6 @@
    torch.backends.cudnn.deterministic = args.cudnn_deterministic
    # ddp init
    os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_id)
    args.distributed = args.ngpu > 1 or args.dist_world_size > 1
    distributed_option = build_distributed(args)
    # for logging