Forráskód Böngészése

modify uniform output

zhangyubo0722 1 éve
szülő
commit
43c03d0bcc

+ 1 - 1
docs/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.md

@@ -59,7 +59,7 @@ PaddleX 所提供的预训练的模型产线均可以快速体验效果,你可
 一行命令即可快速体验语义分割产线效果,使用 [测试文件](https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png),并将 `--input` 替换为本地路径,进行预测
 
 ```
-paddlex --pipeline semantic_segmentation --input semantic_segmentation/makassaridn-road_demo.png --device gpu:0
+paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0
 ```
 参数说明:
 

+ 1 - 1
docs/pipeline_usage/tutorials/ocr_pipelines/table_recognition.md

@@ -90,7 +90,7 @@ PaddleX 所提供的预训练的模型产线均可以快速体验效果,你可
 在本地使用通用表格识别产线前,请确保您已经按照[PaddleX本地安装教程](../../../installation/installation.md)完成了PaddleX的wheel包安装。
 
 ### 2.1 命令行方式体验
-一行命令即可快速体验表格识别产线效果,使用 [测试文件](ttps://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg),并将 `--input` 替换为本地路径,进行预测
+一行命令即可快速体验表格识别产线效果,使用 [测试文件](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg),并将 `--input` 替换为本地路径,进行预测
 
 ```
 paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0

+ 3 - 3
docs/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.md

@@ -44,10 +44,10 @@ PaddleX 所提供的预训练的模型产线均可以快速体验效果,你可
 在本地使用通用时序异常检测产线前,请确保您已经按照[PaddleX本地安装教程](../../../installation/installation.md)完成了PaddleX的wheel包安装。
 
 #### 2.2.1 命令行方式体验
-一行命令即可快速体验时序异常检测产线效果,使用 [测试文件](https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.cs),并将 `--input` 替换为本地路径,进行预测
+一行命令即可快速体验时序异常检测产线效果,使用 [测试文件](https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv),并将 `--input` 替换为本地路径,进行预测
 
 ```
-paddlex --pipeline ts_ad --input ts_ad.cs --device gpu:0
+paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0
 ```
 参数说明:
 
@@ -131,7 +131,7 @@ for res in output:
 |---------------|-----------------------------------------------------------------------------------------------------------|
 | Python Var    | 支持直接传入Python变量,如numpy.ndarray表示的图像数据。                                               |
 | str         | 支持传入待预测数据文件路径,如图像文件的本地路径:`/root/data/img.jpg`。                                   |
-| str           | 支持传入待预测数据文件URL,如图像文件的网络URL:[示例](https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.cs)。|
+| str           | 支持传入待预测数据文件URL,如图像文件的网络URL:[示例](https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv)。|
 | str           | 支持传入本地目录,该目录下需包含待预测数据文件,如本地路径:`/root/data/`。                               |
 | dict          | 支持传入字典类型,字典的key需与具体任务对应,如图像分类任务对应\"img\",字典的val支持上述类型数据,例如:`{\"img\": \"/root/data1\"}`。|
 | list          | 支持传入列表,列表元素需为上述类型数据,如`[numpy.ndarray, numpy.ndarray],[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]`,`[\"/root/data1\", \"/root/data2\"]`,`[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]`。|

+ 7 - 0
paddlex/modules/base/trainer.py

@@ -61,6 +61,13 @@ class BaseTrainer(ABC, metaclass=AutoRegisterABCMetaClass):
         train_args = self.get_train_kwargs()
         if self.benchmark_config is not None:
             train_args.update({"benchmark": self.benchmark_config})
+        train_args.update(
+            {
+                "uniform_output_enabled": self.train_config.get(
+                    "uniform_output_enabled", True
+                )
+            }
+        )
         train_result = self.pdx_model.train(**train_args)
         assert (
             train_result.returncode == 0

+ 1 - 4
paddlex/repo_apis/PaddleClas_api/cls/model.py

@@ -114,10 +114,7 @@ class ClsModel(BaseModel):
                 config._update_amp(amp)
             # PDX related settings
             device_type = device.split(":")[0]
-            if device_type in ["npu", "xpu", "mlu"]:
-                uniform_output_enabled = False
-            else:
-                uniform_output_enabled = True
+            uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
             config.update([f"Global.uniform_output_enabled={uniform_output_enabled}"])
             config.update([f"Global.pdx_model_name={self.name}"])
             hpi_config_path = self.model_info.get("hpi_config_path", None)

+ 1 - 4
paddlex/repo_apis/PaddleDetection_api/instance_seg/model.py

@@ -126,10 +126,7 @@ class InstanceSegModel(BaseModel):
                 cli_args.append(CLIArgument("--enable_ce", enable_ce))
 
         # PDX related settings
-        if device_type in ["npu", "xpu", "mlu"]:
-            uniform_output_enabled = False
-        else:
-            uniform_output_enabled = True
+        uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
         config.update({"uniform_output_enabled": uniform_output_enabled})
         config.update({"pdx_model_name": self.name})
         hpi_config_path = self.model_info.get("hpi_config_path", None)

+ 1 - 4
paddlex/repo_apis/PaddleDetection_api/object_det/model.py

@@ -130,10 +130,7 @@ class DetModel(BaseModel):
                 cli_args.append(CLIArgument("--enable_ce", enable_ce))
 
         # PDX related settings
-        if device_type in ["npu", "xpu", "mlu"]:
-            uniform_output_enabled = False
-        else:
-            uniform_output_enabled = True
+        uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
         config.update({"uniform_output_enabled": uniform_output_enabled})
         config.update({"pdx_model_name": self.name})
         hpi_config_path = self.model_info.get("hpi_config_path", None)

+ 1 - 4
paddlex/repo_apis/PaddleOCR_api/text_rec/model.py

@@ -134,10 +134,7 @@ class TextRecModel(BaseModel):
 
         # PDX related settings
         device_type = device.split(":")[0]
-        if device_type in ["npu", "xpu", "mlu"]:
-            uniform_output_enabled = False
-        else:
-            uniform_output_enabled = True
+        uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
         config.update({"Global.uniform_output_enabled": uniform_output_enabled})
         config.update({"Global.pdx_model_name": self.name})
         hpi_config_path = self.model_info.get("hpi_config_path", None)

+ 1 - 4
paddlex/repo_apis/PaddleSeg_api/seg/model.py

@@ -166,10 +166,7 @@ class SegModel(BaseModel):
                 cli_args.append(CLIArgument("--seed", seed))
 
         # PDX related settings
-        if device_type in ["npu", "xpu", "mlu"]:
-            uniform_output_enabled = False
-        else:
-            uniform_output_enabled = True
+        uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
         config.set_val("uniform_output_enabled", uniform_output_enabled)
         config.set_val("pdx_model_name", self.name)
         hpi_config_path = self.model_info.get("hpi_config_path", None)

+ 1 - 4
paddlex/repo_apis/PaddleTS_api/ts_base/model.py

@@ -110,10 +110,7 @@ class TSModel(BaseModel):
             if num_workers is not None:
                 cli_args.append(CLIArgument("--num_workers", num_workers))
         # PDX related settings
-        if device_type in ["npu", "xpu", "mlu"]:
-            uniform_output_enabled = False
-        else:
-            uniform_output_enabled = True
+        uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
         config.update({"uniform_output_enabled": uniform_output_enabled})
         config.update({"pdx_model_name": self.name})