From 485e2da8998969ee8c855dcb2d9c3eaaed1293ae Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 23 Jun 2022 10:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0TRT=E8=BD=AC=E6=8D=A2=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=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_convert.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/routers/repo/ai_model_convert.go b/routers/repo/ai_model_convert.go index aac66d078..ba98e5b7a 100644 --- a/routers/repo/ai_model_convert.go +++ b/routers/repo/ai_model_convert.go @@ -52,6 +52,9 @@ const ( CONVERT_FORMAT_ONNX = 0 CONVERT_FORMAT_TRT = 1 + NetOutputFormat_FP32 = 0 + NetOutputFormat_FP16 = 1 + NPU_MINDSPORE_IMAGE_ID = 35 NPU_TENSORFLOW_IMAGE_ID = 121 @@ -460,7 +463,15 @@ func getGpuModelConvertCommand(name string, modelFile string, modelConvert *mode h = intputshape[2] w = intputshape[3] } - command += "python3 /code/" + bootfile + " --model " + modelFile + " --n " + n + " --c " + c + " --h " + h + " --w " + w + " > " + ModelMountPath + "/" + name + "-" + LogFile + command += "python3 /code/" + bootfile + " --model " + modelFile + " --n " + n + " --c " + c + " --h " + h + " --w " + w + if modelConvert.DestFormat == CONVERT_FORMAT_TRT { + if modelConvert.NetOutputFormat == NetOutputFormat_FP16 { + command += " --fp16 True" + } else { + command += " --fp16 False" + } + } + command += " > " + ModelMountPath + "/" + name + "-" + LogFile return command }