MCPcopy Index your code
hub / github.com/THUDM/GLM / get_command

Function get_command

scripts/dispatcher.py:86–109  ·  view source on GitHub ↗
(model, task, n_gpu, config, overwrite=True)

Source from the content-addressed store, hash-verified

84
85
86def 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
112def chain_configs(configs):

Callers 1

_launch_experimentFunction · 0.85

Calls 1

update_cmdFunction · 0.85

Tested by

no test coverage detected