Browse Source

提交代码。增加TRT转换后端支持。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.7.1
zouap 3 years ago
parent
commit
485e2da899
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      routers/repo/ai_model_convert.go

+ 12
- 1
routers/repo/ai_model_convert.go View File

@@ -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
}



Loading…
Cancel
Save