diff --git a/modules/grampus/grampus.go b/modules/grampus/grampus.go index 4c46296e5..95985e533 100755 --- a/modules/grampus/grampus.go +++ b/modules/grampus/grampus.go @@ -40,7 +40,7 @@ const ( ProcessorTypeNPU = "npu.huawei.com/NPU" ProcessorTypeGPU = "nvidia.com/gpu" - CommandPrepareScript = "pwd;cd /tmp;mkdir output;mkdir code;mkdir dataset;wget https://git.openi.org.cn/lewis/script_for_grampus/archive/master.zip;unzip master.zip;cd script_for_grampus;chmod 777 sync_for_arm uploader_for_grampus;" + CommandPrepareScript = "pwd;cd /tmp;mkdir output;mkdir code;mkdir dataset;wget -q https://git.openi.org.cn/lewis/script_for_grampus/archive/master.zip;unzip -q master.zip;cd script_for_grampus;chmod 777 sync_for_arm uploader_for_grampus;" CodeArchiveName = "master.zip" ) diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 552fc9b70..542b1c386 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -312,9 +312,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain } //prepare command - //todo: download code, download dataset, unzip dataset, exec code, upload model command, err := generateCommand(repo.Name, grampus.ProcessorTypeNPU, codeObsPath+cloudbrain.DefaultBranchName+".zip", dataObsPath+attachment.Name, bootFile, params, setting.CodePathPrefix+jobName+modelarts.OutputPath, attachment.Name) - log.Info(command) commitID, _ := ctx.Repo.GitRepo.GetBranchCommitID(branchName) @@ -550,7 +548,12 @@ func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile } //unzip code & dataset - commandUnzip := "cd /tmp/dataset;unzip " + datasetName + ";cd /tmp/code;unzip master.zip;" + toolUnzip := "unzip -q " + if strings.HasSuffix(datasetName, ".tar.gz") { + toolUnzip = "tar -zxvf " + } + commandUnzip := "cd /tmp/dataset;" + toolUnzip + datasetName + ";cd /tmp/code;unzip -q master.zip;" + commandUnzip += "cd /tmp/dataset/" + strings.TrimSuffix(datasetName, ".zip") + ";ls;" command += commandUnzip //exec code @@ -573,7 +576,7 @@ func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile } } - commandCode := "cd " + repoName + ";python " + bootFile + paramCode + ";" + commandCode := "cd /tmp/code/" + repoName + ";python " + bootFile + paramCode + ";" command += commandCode //upload models