Rename pybind/fastdeploy_runtime.cc to pybind/runtime.cc (#273)

* fix yaml

* Rename pybind/fastdeploy_runtime.cc to runtime.cc
This commit is contained in:
Jason
2022-09-23 11:16:02 +08:00
committed by GitHub
parent efa7411ebb
commit 2d3e61582d
7 changed files with 11 additions and 9 deletions

View File

@@ -13,6 +13,7 @@
# limitations under the License.
import fastdeploy as fd
from fastdeploy import ModelFormat
import numpy as np
# 下载模型并解压
@@ -21,7 +22,7 @@ fd.download(model_url, path=".")
option = fd.RuntimeOption()
option.set_model_path("mobilenetv2.onnx", model_format="onnx")
option.set_model_path("mobilenetv2.onnx", model_format=ModelFormat.ONNX)
option.use_openvino_backend()

View File

@@ -13,6 +13,7 @@
# limitations under the License.
import fastdeploy as fd
from fastdeploy import ModelFormat
import numpy as np
# 下载模型并解压
@@ -21,7 +22,7 @@ fd.download(model_url, path=".")
option = fd.RuntimeOption()
option.set_model_path("mobilenetv2.onnx", model_format="onnx")
option.set_model_path("mobilenetv2.onnx", model_format=ModelFormat.ONNX)
# **** GPU 配置 ***
option.use_gpu(0)

View File

@@ -139,16 +139,16 @@ ModelFormat GuessModelFormat(const std::string& model_file) {
void RuntimeOption::SetModelPath(const std::string& model_path,
const std::string& params_path,
const std::string& _model_format) {
if (_model_format == "paddle") {
const ModelFormat& format) {
if (format == ModelFormat::PADDLE) {
model_file = model_path;
params_file = params_path;
model_format = ModelFormat::PADDLE;
} else if (_model_format == "onnx") {
} else if (format == ModelFormat::ONNX) {
model_file = model_path;
model_format = ModelFormat::ONNX;
} else {
FDASSERT(false, "The model format only can be 'paddle' or 'onnx'.");
FDASSERT(false, "The model format only can be ModelFormat::PADDLE/ModelFormat::ONNX.");
}
}

View File

@@ -43,7 +43,7 @@ struct FASTDEPLOY_DECL RuntimeOption {
// model_format support 'paddle' / 'onnx' now.
void SetModelPath(const std::string& model_path,
const std::string& params_path = "",
const std::string& _model_format = "paddle");
const ModelFormat& format = ModelFormat::PADDLE);
// set model inference in GPU
void UseCpu();

View File

@@ -18,7 +18,7 @@ import sys
from .c_lib_wrap import (ModelFormat, Backend, FDDataType, TensorInfo, Device,
FDTensor, is_built_with_gpu, is_built_with_ort,
is_built_with_paddle, is_built_with_trt,
ModelFormat, is_built_with_paddle, is_built_with_trt,
get_default_cuda_directory)
from .runtime import Runtime, RuntimeOption

View File

@@ -55,7 +55,7 @@ class RuntimeOption:
self._option = C.RuntimeOption()
def set_model_path(self, model_path, params_path="",
model_format="paddle"):
model_format=C.ModelFormat.PADDLE):
return self._option.set_model_path(model_path, params_path,
model_format)