(model, task, n_gpu, config, overwrite=True)
| 84 | |
| 85 | |
| 86 | def get_command(model, task, n_gpu, config, overwrite=True): |
| 87 | |
| 88 | distributed_args = DISTRIBUTED_ARGS.format(N_GPU=n_gpu, MASTER_PORT=random.randint(10000, 65535)) |
| 89 | |
| 90 | config = copy.deepcopy(config) |
| 91 | hyper = "-".join([f"{k}-{v}" for k,v in config.items()]) |
| 92 | experiment_name = f"{model}-{task}/{hyper}" |
| 93 | |
| 94 | command = (f"python -m torch.distributed.launch {distributed_args} finetune_gpt2.py " |
| 95 | f"--finetune {MODEL_CONFIG[model]} {TASK_CONFIG[task]} {COMMON_ARGS} " |
| 96 | f"--experiment-name {experiment_name} " |
| 97 | f"--save {CHECKPOINT_PATH} " |
| 98 | f"--checkpoint-activations " |
| 99 | f"--eval-batch-size 16 ") |
| 100 | |
| 101 | config["batch-size"] = config["batch-size"] // n_gpu |
| 102 | command = update_cmd(command, config) |
| 103 | if overwrite: |
| 104 | command += "--overwrite " |
| 105 | |
| 106 | result_path = RESULT_PATH.format(EXPERIMENT_NAME=experiment_name) |
| 107 | log_path = LOG_PATH + f"{model}-{task}-{hyper}.txt" |
| 108 | |
| 109 | return command, result_path, log_path |
| 110 | |
| 111 | |
| 112 | def chain_configs(configs): |
no test coverage detected