From 47829808c08333bde1abcfeb020f8496eff61579 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 15 Nov 2022 16:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 2221a2d4c..7eedb9bc4 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -76,24 +76,14 @@ func saveModelByParameters(jobId string, versionName string, name string, versio //download model zip //train type if aiTask.ComputeResource == models.NPUResource { cloudType = models.TypeCloudBrainTwo - spec, err := resource.GetCloudbrainSpec(aiTask.ID) - if err == nil { - flaverName := "NPU: " + fmt.Sprint(spec.AccCardsNum) + "*" + spec.AccCardType + ",CPU: " + fmt.Sprint(spec.CpuCores) + "," - if spec.GPUMemGiB > 0 { - flaverName += ctx.Tr("cloudbrain.gpu_memory") + ": " + fmt.Sprint(spec.GPUMemGiB) + "GB," - } - flaverName += ctx.Tr("cloudbrain.memory") + ": " + fmt.Sprint(spec.MemGiB) + "GB" - aiTask.FlavorName = flaverName - } } else if aiTask.ComputeResource == models.GPUResource { cloudType = models.TypeCloudBrainOne - spec, err := resource.GetCloudbrainSpec(aiTask.ID) - if err == nil { - flaverName := "GPU: " + fmt.Sprint(spec.AccCardsNum) + "*" + spec.AccCardType + ",CPU: " + fmt.Sprint(spec.CpuCores) + "," + ctx.Tr("cloudbrain.memory") + ": " + fmt.Sprint(spec.MemGiB) + "GB," + ctx.Tr("cloudbrain.shared_memory") + ": " + fmt.Sprint(spec.ShareMemGiB) + "GB" - aiTask.FlavorName = flaverName - } } - + spec, err := resource.GetCloudbrainSpec(aiTask.ID) + if err == nil { + specJson, _ := json.Marshal(spec) + aiTask.FlavorName = string(specJson) + } accuracy := make(map[string]string) accuracy["F1"] = "" accuracy["Recall"] = ""