mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-04 16:22:57 +08:00
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:
@@ -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()
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user