Browse Source

gpu add param

tags/v1.22.6.2^2
lewis 3 years ago
parent
commit
d1c8e345e5
1 changed files with 16 additions and 14 deletions
  1. +16
    -14
      routers/repo/cloudbrain.go

+ 16
- 14
routers/repo/cloudbrain.go View File

@@ -215,20 +215,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
resourceSpecId := form.ResourceSpecId
branchName := form.BranchName
repo := ctx.Repo.Repository

tpl := tplCloudBrainNew
command := cloudbrain.Command
if jobType == string(models.JobTypeTrain) {
tpl = tplCloudBrainTrainJobNew
commandTrain, err := getTrainJobCommand(form)
if err != nil {
log.Error("getTrainJobCommand failed: %v", err)
ctx.RenderWithErr(err.Error(), tpl, &form)
return
}

command = commandTrain
}

tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, jobType, displayJobName)
if err == nil {
@@ -282,6 +269,19 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
return
}

command := cloudbrain.Command
if jobType == string(models.JobTypeTrain) {
tpl = tplCloudBrainTrainJobNew
commandTrain, err := getTrainJobCommand(form, datasetNames)
if err != nil {
log.Error("getTrainJobCommand failed: %v", err)
ctx.RenderWithErr(err.Error(), tpl, &form)
return
}

command = commandTrain
}

if branchName == "" {
branchName = cloudbrain.DefaultBranchName
}
@@ -2246,7 +2246,7 @@ func CloudBrainTrainJobNew(ctx *context.Context) {
ctx.HTML(http.StatusOK, tplCloudBrainTrainJobNew)
}

func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) {
func getTrainJobCommand(form auth.CreateCloudBrainForm, datasetNames string) (string, error) {
var command string
bootFile := strings.TrimSpace(form.BootFile)
params := form.Params
@@ -2270,6 +2270,8 @@ func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) {
}
}

param += " --dataset_list=" + datasetNames

command += "python /code/" + bootFile + param + " > " + cloudbrain.ModelMountPath + "/" + form.DisplayJobName + "-" + cloudbrain.LogFile

return command, nil


Loading…
Cancel
Save