|
@@ -18,7 +18,6 @@ import ( |
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/services/reward/point/account" |
|
|
"code.gitea.io/gitea/services/reward/point/account" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/auth" |
|
|
"code.gitea.io/gitea/modules/auth" |
|
|
"code.gitea.io/gitea/modules/git" |
|
|
"code.gitea.io/gitea/modules/git" |
|
|
"code.gitea.io/gitea/modules/grampus" |
|
|
"code.gitea.io/gitea/modules/grampus" |
|
@@ -721,7 +720,7 @@ func grampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain |
|
|
req.CkptName = form.CkptName |
|
|
req.CkptName = form.CkptName |
|
|
req.ModelVersion = form.ModelVersion |
|
|
req.ModelVersion = form.ModelVersion |
|
|
req.PreTrainModelUrl = form.PreTrainModelUrl |
|
|
req.PreTrainModelUrl = form.PreTrainModelUrl |
|
|
|
|
|
|
|
|
|
|
|
req.PreTrainModelPath = preTrainModelPath |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
err = grampus.GenerateTrainJob(ctx, req) |
|
|
err = grampus.GenerateTrainJob(ctx, req) |
|
@@ -950,8 +949,7 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo |
|
|
command += "pwd;cd " + workDir + fmt.Sprintf(grampus.CommandPrepareScript, setting.Grampus.SyncScriptProject, setting.Grampus.SyncScriptProject) |
|
|
command += "pwd;cd " + workDir + fmt.Sprintf(grampus.CommandPrepareScript, setting.Grampus.SyncScriptProject, setting.Grampus.SyncScriptProject) |
|
|
//download code & dataset |
|
|
//download code & dataset |
|
|
if processorType == grampus.ProcessorTypeNPU { |
|
|
if processorType == grampus.ProcessorTypeNPU { |
|
|
commandDownload := "./downloader_for_obs " + setting.Bucket + " " + codeRemotePath + " " + grampus.CodeArchiveName + " '" + dataRemotePath + "' '" + datasetName + "'" |
|
|
|
|
|
commandDownload = processPretrainModelParameter(pretrainModelPath, pretrainModelFileName, commandDownload) |
|
|
|
|
|
|
|
|
commandDownload := "./downloader_for_obs " + setting.Bucket + " " + codeRemotePath + " " + grampus.CodeArchiveName + ";" |
|
|
command += commandDownload |
|
|
command += commandDownload |
|
|
} else if processorType == grampus.ProcessorTypeGPU { |
|
|
} else if processorType == grampus.ProcessorTypeGPU { |
|
|
commandDownload := "./downloader_for_minio " + setting.Grampus.Env + " " + codeRemotePath + " " + grampus.CodeArchiveName + " '" + dataRemotePath + "' '" + datasetName + "'" |
|
|
commandDownload := "./downloader_for_minio " + setting.Grampus.Env + " " + codeRemotePath + " " + grampus.CodeArchiveName + " '" + dataRemotePath + "' '" + datasetName + "'" |
|
@@ -960,10 +958,14 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//unzip code & dataset |
|
|
//unzip code & dataset |
|
|
unZipDatasetCommand := generateDatasetUnzipCommand(datasetName) |
|
|
|
|
|
|
|
|
|
|
|
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + unZipDatasetCommand |
|
|
|
|
|
command += commandUnzip |
|
|
|
|
|
|
|
|
if processorType == grampus.ProcessorTypeNPU { |
|
|
|
|
|
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;" |
|
|
|
|
|
command += commandUnzip |
|
|
|
|
|
} else if processorType == grampus.ProcessorTypeGPU { |
|
|
|
|
|
unZipDatasetCommand := generateDatasetUnzipCommand(datasetName) |
|
|
|
|
|
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + unZipDatasetCommand |
|
|
|
|
|
command += commandUnzip |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
command += "echo \"unzip finished;start to exec code;\";" |
|
|
command += "echo \"unzip finished;start to exec code;\";" |
|
|
|
|
|
|
|
@@ -993,14 +995,13 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if pretrainModelFileName != "" { |
|
|
|
|
|
paramCode += " --ckpt_url" + "=" + workDir + "pretrainmodel/" + pretrainModelFileName |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var commandCode string |
|
|
var commandCode string |
|
|
if processorType == grampus.ProcessorTypeNPU { |
|
|
if processorType == grampus.ProcessorTypeNPU { |
|
|
commandCode = "/bin/bash /home/work/run_train_for_openi.sh " + workDir + "code/" + strings.ToLower(repoName) + "/" + bootFile + " /tmp/log/train.log" + paramCode + ";" |
|
|
commandCode = "/bin/bash /home/work/run_train_for_openi.sh " + workDir + "code/" + strings.ToLower(repoName) + "/" + bootFile + " /tmp/log/train.log" + paramCode + ";" |
|
|
} else if processorType == grampus.ProcessorTypeGPU { |
|
|
} else if processorType == grampus.ProcessorTypeGPU { |
|
|
|
|
|
if pretrainModelFileName != "" { |
|
|
|
|
|
paramCode += " --ckpt_url" + "=" + workDir + "pretrainmodel/" + pretrainModelFileName |
|
|
|
|
|
} |
|
|
commandCode = "cd " + workDir + "code/" + strings.ToLower(repoName) + ";python " + bootFile + paramCode + ";" |
|
|
commandCode = "cd " + workDir + "code/" + strings.ToLower(repoName) + ";python " + bootFile + paramCode + ";" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1041,14 +1042,14 @@ func generateDatasetUnzipCommand(datasetName string) string { |
|
|
datasetNameArray := strings.Split(datasetName, ";") |
|
|
datasetNameArray := strings.Split(datasetName, ";") |
|
|
if len(datasetNameArray) == 1 { //单数据集 |
|
|
if len(datasetNameArray) == 1 { //单数据集 |
|
|
unZipDatasetCommand = "unzip -q '" + datasetName + "';" |
|
|
unZipDatasetCommand = "unzip -q '" + datasetName + "';" |
|
|
if strings.HasSuffix(datasetName, ".tar.gz") { |
|
|
|
|
|
|
|
|
if strings.HasSuffix(datasetNameArray[0], ".tar.gz") { |
|
|
unZipDatasetCommand = "tar --strip-components=1 -zxvf '" + datasetName + "';" |
|
|
unZipDatasetCommand = "tar --strip-components=1 -zxvf '" + datasetName + "';" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { //多数据集 |
|
|
} else { //多数据集 |
|
|
for _, datasetNameTemp := range datasetNameArray { |
|
|
for _, datasetNameTemp := range datasetNameArray { |
|
|
if strings.HasSuffix(datasetName, ".tar.gz") { |
|
|
|
|
|
unZipDatasetCommand = unZipDatasetCommand + "tar -zxvf '" + datasetName + "';" |
|
|
|
|
|
|
|
|
if strings.HasSuffix(datasetNameTemp, ".tar.gz") { |
|
|
|
|
|
unZipDatasetCommand = unZipDatasetCommand + "tar -zxvf '" + datasetNameTemp + "';" |
|
|
} else { |
|
|
} else { |
|
|
unZipDatasetCommand = unZipDatasetCommand + "unzip -q '" + datasetNameTemp + "' -d './" + strings.TrimSuffix(datasetNameTemp, ".zip") + "';" |
|
|
unZipDatasetCommand = unZipDatasetCommand + "unzip -q '" + datasetNameTemp + "' -d './" + strings.TrimSuffix(datasetNameTemp, ".zip") + "';" |
|
|
} |
|
|
} |
|
|