From 038449247b469c4ac6f61eb7e87b37fe6f0b42c4 Mon Sep 17 00:00:00 2001 From: taoboyang Date: Thu, 26 Dec 2024 18:01:45 +0800 Subject: [PATCH 1/2] Fit gil lock for new version of pybind11 --- bmf/engine/c_engine/src/loader/py_module_loader.cpp | 3 ++- bmf/engine/connector/src/connector.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bmf/engine/c_engine/src/loader/py_module_loader.cpp b/bmf/engine/c_engine/src/loader/py_module_loader.cpp index cff48f0f..b4c38a50 100644 --- a/bmf/engine/c_engine/src/loader/py_module_loader.cpp +++ b/bmf/engine/c_engine/src/loader/py_module_loader.cpp @@ -185,6 +185,7 @@ class PyModuleFactory : public ModuleFactoryI { std::shared_ptr make(int32_t node_id, const JsonParam &json_param) override { + py::gil_scoped_acquire gil; auto [module_cls, _] = factory_(); return std::make_shared(module_cls, node_id, json_param); @@ -263,7 +264,6 @@ bmf_import_py_module(const char *module_path, const char *module, std::string cls_s(cls); std::string register_info_func = "register_" + cls_s + "_info"; auto module_factory = [=]() -> std::tuple { - py::gil_scoped_acquire gil; auto py_module = py::module_::import(temp_module_name.c_str()); auto module_cls = py_module.attr(cls_s.c_str()); py::object module_info_register = py::none(); @@ -273,6 +273,7 @@ bmf_import_py_module(const char *module_path, const char *module, } return std::make_tuple(module_cls, module_info_register); }; + return new bmf_sdk::PyModuleFactory(module_factory); } catch (std::exception &e) { diff --git a/bmf/engine/connector/src/connector.cpp b/bmf/engine/connector/src/connector.cpp index 025f4cf7..b1613d63 100644 --- a/bmf/engine/connector/src/connector.cpp +++ b/bmf/engine/connector/src/connector.cpp @@ -99,8 +99,8 @@ BMFGraph::BMFGraph(const std::string &graph_config, bool is_path, throw std::logic_error("Trying to bind an unexisted callback."); callback_bindings[nd.id]->add_callback( cb.first, - *internal::ConnectorMapping::ModuleCallbackInstanceMapping() - .get(cb.second)); + std::move(*internal::ConnectorMapping::ModuleCallbackInstanceMapping() + .get(cb.second))); } } From 8d0f04d29192065077dd42a9d07d838bdbb01c9d Mon Sep 17 00:00:00 2001 From: "huli.bruce" Date: Fri, 27 Dec 2024 21:08:05 +0800 Subject: [PATCH 2/2] fix robot effect ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93cd6075..7b8ddf1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: run: | sudo apt update sudo apt install -y make git pkg-config libssl-dev cmake binutils-dev libgoogle-glog-dev gcc g++ golang wget libgl1 - sudo apt install -y python3.9 python3-dev python3-pip + sudo apt install -y python3.9 python3-dev python3-pip libsndfile1 libsndfile1-dev sudo python3 -m pip install timeout_decorator numpy onnxruntime pytest opencv-python librosa # The version of ffmpeg installed via apt is 4.2, but the current test results are based on version 4.4, so here we need to compile version 4.4 of ffmpeg from source code #apt install -y ffmpeg libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev