Pārlūkot izejas kodu

[Setup.py] Modify setup.py (#4158)

* modify setup.py, docs/3d_bev_detection and ops/__init__.py

* modidy setup.py

* modify setup.py docs and pipeline_v4.py

* Update 3d_bev_detection.md

* Update 3d_bev_detection.en.md

* modify setup.py

---------

Co-authored-by: Lin Manhui <mhlin425@whu.edu.cn>
guoshengjian 5 mēneši atpakaļ
vecāks
revīzija
ad7abdbf0f

+ 2 - 0
docs/pipeline_usage/tutorials/cv_pipelines/3d_bev_detection.en.md

@@ -12,6 +12,8 @@ BEVFusion is a multi-modal 3D object detection model that fuses surround camera
 
 <img src="https://raw.githubusercontent.com/cuicheng01/PaddleX_doc_images/main/images/pipelines/3d_bev_detection/01.png">
 
+Please note that the 3D multi-modal fusion detection pipeline currently does not support Python 3.12 or above.
+
 <b>The 3D multi-modal fusion detection pipeline includes a 3D multi-modal fusion detection module</b>,which contains <b>a BEVFusion model</b>. We provide benchmark data for this model:
 
 <p><b>3D Multi-modal Fusion Detection Module:</b></p>

+ 2 - 0
docs/pipeline_usage/tutorials/cv_pipelines/3d_bev_detection.md

@@ -12,6 +12,8 @@ BEVFusion 是一种多模态 3D 目标检测模型,通过将环视摄像头图
 
 <img src="https://raw.githubusercontent.com/cuicheng01/PaddleX_doc_images/main/images/pipelines/3d_bev_detection/01.png">
 
+请注意,3D多模态融合检测产线目前暂不支持Python 3.12及以上版本。
+
 <b>3D多模态融合检测产线中包含了3D多模态融合检测模块</b>,模块中包含了一个<b>BEVFusion模型</b>,我们提供了该模型的 benchmark 数据:
 
 <p><b>3D多模态融合检测模块:</b></p>

+ 1 - 1
paddlex/inference/pipelines/pp_chatocr/pipeline_v4.py

@@ -638,7 +638,7 @@ class PP_ChatOCRv4_Pipeline(PP_ChatOCR_Pipeline):
 
         for image_array in self.img_reader([input]):
 
-            image_string = cv2.imencode(".jpg", image_array)[1].tostring()
+            image_string = cv2.imencode(".jpg", image_array)[1].tobytes()
             image_base64 = base64.b64encode(image_string).decode("utf-8")
             result = {}
             for key in key_list:

+ 6 - 3
paddlex/ops/__init__.py

@@ -66,11 +66,14 @@ class CustomOpNotFoundException(Exception):
 
 
 class CustomOperatorPathFinder:
-    def find_module(self, fullname: str, path: str = None):
+    def find_spec(self, fullname: str, path, target=None):
         if not fullname.startswith("paddlex.ops"):
             return None
-
-        return CustomOperatorPathLoader()
+        return importlib.machinery.ModuleSpec(
+            name=fullname,
+            loader=CustomOperatorPathLoader(),
+            is_package=False,        
+        )
 
 
 class CustomOperatorPathLoader:

+ 6 - 9
setup.py

@@ -37,17 +37,14 @@ DEP_SPECS = {
     "imagesize": "",
     "Jinja2": "",
     "joblib": "",
-    "langchain": "== 0.2.17",
-    "langchain-community": "== 0.2.17",
+    "langchain": "== 0.3.25",
+    "langchain-community": "== 0.3.24",
     "langchain-core": "",
-    "langchain-openai": "== 0.1.25",
+    "langchain-openai": "== 0.3.19",
     "lxml": "",
     "matplotlib": "",
-    "numpy": [
-        "== 1.24.4; python_version < '3.12'",
-        "== 1.26.4; python_version >= '3.12'",
-    ],
-    "openai": "== 1.63.2",
+    "numpy": ">= 1.24",
+    "openai": "== 1.68.2",
     "opencv-contrib-python": "== 4.10.0.84",
     "openpyxl": "",
     "packaging": "",
@@ -70,7 +67,7 @@ DEP_SPECS = {
     "soundfile": "",
     "starlette": ">= 0.36",
     "tiktoken": "",
-    "tokenizers": "== 0.19.1",
+    "tokenizers": ">= 0.19",
     "tqdm": "",
     "typing-extensions": "",
     "ujson": "",