paddlex 3.0.0rc1__py3-none-any.whl → 3.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paddlex/.version +1 -1
- paddlex/__init__.py +1 -1
- paddlex/configs/modules/chart_parsing/PP-Chart2Table.yaml +13 -0
- paddlex/configs/modules/doc_vlm/PP-DocBee2-3B.yaml +14 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-L.yaml +40 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-M.yaml +40 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-S.yaml +40 -0
- paddlex/configs/modules/layout_detection/PP-DocBlockLayout.yaml +40 -0
- paddlex/configs/modules/layout_detection/PP-DocLayout-L.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout-M.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout-S.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout_plus-L.yaml +40 -0
- paddlex/configs/modules/text_detection/PP-OCRv5_mobile_det.yaml +40 -0
- paddlex/configs/modules/text_detection/PP-OCRv5_server_det.yaml +40 -0
- paddlex/configs/modules/text_recognition/PP-OCRv5_mobile_rec.yaml +39 -0
- paddlex/configs/modules/text_recognition/PP-OCRv5_server_rec.yaml +39 -0
- paddlex/configs/modules/textline_orientation/PP-LCNet_x1_0_textline_ori.yaml +41 -0
- paddlex/configs/pipelines/OCR.yaml +7 -6
- paddlex/configs/pipelines/PP-ChatOCRv3-doc.yaml +3 -1
- paddlex/configs/pipelines/PP-ChatOCRv4-doc.yaml +91 -34
- paddlex/configs/pipelines/PP-StructureV3.yaml +72 -72
- paddlex/configs/pipelines/doc_understanding.yaml +1 -1
- paddlex/configs/pipelines/formula_recognition.yaml +2 -2
- paddlex/configs/pipelines/layout_parsing.yaml +3 -2
- paddlex/configs/pipelines/seal_recognition.yaml +1 -0
- paddlex/configs/pipelines/table_recognition.yaml +2 -1
- paddlex/configs/pipelines/table_recognition_v2.yaml +7 -1
- paddlex/hpip_links.html +20 -20
- paddlex/inference/common/batch_sampler/doc_vlm_batch_sampler.py +33 -10
- paddlex/inference/common/batch_sampler/image_batch_sampler.py +34 -25
- paddlex/inference/common/result/mixin.py +19 -12
- paddlex/inference/models/base/predictor/base_predictor.py +2 -8
- paddlex/inference/models/common/static_infer.py +29 -73
- paddlex/inference/models/common/tokenizer/__init__.py +2 -0
- paddlex/inference/models/common/tokenizer/clip_tokenizer.py +1 -1
- paddlex/inference/models/common/tokenizer/gpt_tokenizer.py +2 -2
- paddlex/inference/models/common/tokenizer/qwen2_5_tokenizer.py +112 -0
- paddlex/inference/models/common/tokenizer/qwen2_tokenizer.py +7 -1
- paddlex/inference/models/common/tokenizer/qwen_tokenizer.py +288 -0
- paddlex/inference/models/common/tokenizer/tokenizer_utils.py +13 -13
- paddlex/inference/models/common/tokenizer/tokenizer_utils_base.py +3 -3
- paddlex/inference/models/common/tokenizer/vocab.py +7 -7
- paddlex/inference/models/common/ts/funcs.py +19 -8
- paddlex/inference/models/common/vlm/conversion_utils.py +99 -0
- paddlex/inference/models/common/vlm/fusion_ops.py +205 -0
- paddlex/inference/models/common/vlm/generation/configuration_utils.py +1 -1
- paddlex/inference/models/common/vlm/generation/logits_process.py +1 -1
- paddlex/inference/models/common/vlm/generation/utils.py +1 -1
- paddlex/inference/models/common/vlm/transformers/configuration_utils.py +3 -3
- paddlex/inference/models/common/vlm/transformers/conversion_utils.py +3 -3
- paddlex/inference/models/common/vlm/transformers/model_outputs.py +2 -2
- paddlex/inference/models/common/vlm/transformers/model_utils.py +7 -31
- paddlex/inference/models/doc_vlm/modeling/GOT_ocr_2_0.py +830 -0
- paddlex/inference/models/doc_vlm/modeling/__init__.py +2 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2.py +1606 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2_5_vl.py +3006 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2_vl.py +0 -105
- paddlex/inference/models/doc_vlm/predictor.py +79 -24
- paddlex/inference/models/doc_vlm/processors/GOT_ocr_2_0.py +97 -0
- paddlex/inference/models/doc_vlm/processors/__init__.py +2 -0
- paddlex/inference/models/doc_vlm/processors/common.py +189 -0
- paddlex/inference/models/doc_vlm/processors/qwen2_5_vl.py +548 -0
- paddlex/inference/models/doc_vlm/processors/qwen2_vl.py +21 -176
- paddlex/inference/models/formula_recognition/predictor.py +8 -2
- paddlex/inference/models/formula_recognition/processors.py +90 -77
- paddlex/inference/models/formula_recognition/result.py +28 -27
- paddlex/inference/models/image_feature/processors.py +3 -4
- paddlex/inference/models/keypoint_detection/predictor.py +3 -0
- paddlex/inference/models/object_detection/predictor.py +2 -0
- paddlex/inference/models/object_detection/processors.py +28 -3
- paddlex/inference/models/object_detection/utils.py +2 -0
- paddlex/inference/models/table_structure_recognition/result.py +0 -10
- paddlex/inference/models/text_detection/predictor.py +8 -0
- paddlex/inference/models/text_detection/processors.py +44 -10
- paddlex/inference/models/text_detection/result.py +0 -10
- paddlex/inference/models/text_recognition/result.py +1 -1
- paddlex/inference/pipelines/__init__.py +9 -5
- paddlex/inference/pipelines/_parallel.py +172 -0
- paddlex/inference/pipelines/anomaly_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/attribute_recognition/pipeline.py +11 -1
- paddlex/inference/pipelines/base.py +14 -4
- paddlex/inference/pipelines/components/faisser.py +1 -1
- paddlex/inference/pipelines/doc_preprocessor/pipeline.py +53 -27
- paddlex/inference/pipelines/formula_recognition/pipeline.py +120 -82
- paddlex/inference/pipelines/formula_recognition/result.py +1 -11
- paddlex/inference/pipelines/image_classification/pipeline.py +16 -6
- paddlex/inference/pipelines/image_multilabel_classification/pipeline.py +16 -6
- paddlex/inference/pipelines/instance_segmentation/pipeline.py +16 -6
- paddlex/inference/pipelines/keypoint_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/layout_parsing/layout_objects.py +859 -0
- paddlex/inference/pipelines/layout_parsing/pipeline.py +34 -47
- paddlex/inference/pipelines/layout_parsing/pipeline_v2.py +832 -260
- paddlex/inference/pipelines/layout_parsing/result.py +4 -17
- paddlex/inference/pipelines/layout_parsing/result_v2.py +259 -245
- paddlex/inference/pipelines/layout_parsing/setting.py +88 -0
- paddlex/inference/pipelines/layout_parsing/utils.py +391 -2028
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/__init__.py +16 -0
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/utils.py +1199 -0
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/xycuts.py +615 -0
- paddlex/inference/pipelines/m_3d_bev_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/multilingual_speech_recognition/pipeline.py +2 -2
- paddlex/inference/pipelines/object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/ocr/pipeline.py +127 -70
- paddlex/inference/pipelines/ocr/result.py +21 -18
- paddlex/inference/pipelines/open_vocabulary_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/open_vocabulary_segmentation/pipeline.py +2 -2
- paddlex/inference/pipelines/pp_chatocr/pipeline_base.py +2 -2
- paddlex/inference/pipelines/pp_chatocr/pipeline_v3.py +2 -5
- paddlex/inference/pipelines/pp_chatocr/pipeline_v4.py +6 -6
- paddlex/inference/pipelines/rotated_object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/seal_recognition/pipeline.py +109 -53
- paddlex/inference/pipelines/semantic_segmentation/pipeline.py +16 -6
- paddlex/inference/pipelines/small_object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/table_recognition/pipeline.py +26 -18
- paddlex/inference/pipelines/table_recognition/pipeline_v2.py +624 -53
- paddlex/inference/pipelines/table_recognition/result.py +1 -1
- paddlex/inference/pipelines/table_recognition/table_recognition_post_processing_v2.py +9 -5
- paddlex/inference/pipelines/ts_anomaly_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/ts_classification/pipeline.py +2 -2
- paddlex/inference/pipelines/ts_forecasting/pipeline.py +2 -2
- paddlex/inference/pipelines/video_classification/pipeline.py +2 -2
- paddlex/inference/pipelines/video_detection/pipeline.py +2 -2
- paddlex/inference/serving/basic_serving/_app.py +46 -13
- paddlex/inference/serving/basic_serving/_pipeline_apps/_common/common.py +5 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/layout_parsing.py +0 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv3_doc.py +0 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv4_doc.py +1 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_structurev3.py +6 -2
- paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition.py +1 -5
- paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition_v2.py +4 -5
- paddlex/inference/serving/infra/utils.py +20 -22
- paddlex/inference/serving/schemas/formula_recognition.py +1 -1
- paddlex/inference/serving/schemas/layout_parsing.py +1 -2
- paddlex/inference/serving/schemas/pp_chatocrv3_doc.py +1 -2
- paddlex/inference/serving/schemas/pp_chatocrv4_doc.py +2 -2
- paddlex/inference/serving/schemas/pp_structurev3.py +10 -6
- paddlex/inference/serving/schemas/seal_recognition.py +1 -1
- paddlex/inference/serving/schemas/table_recognition.py +2 -6
- paddlex/inference/serving/schemas/table_recognition_v2.py +5 -6
- paddlex/inference/utils/hpi.py +30 -16
- paddlex/inference/utils/hpi_model_info_collection.json +666 -162
- paddlex/inference/utils/io/readers.py +12 -12
- paddlex/inference/utils/misc.py +20 -0
- paddlex/inference/utils/mkldnn_blocklist.py +59 -0
- paddlex/inference/utils/official_models.py +140 -5
- paddlex/inference/utils/pp_option.py +74 -9
- paddlex/model.py +2 -2
- paddlex/modules/__init__.py +1 -1
- paddlex/modules/anomaly_detection/evaluator.py +2 -2
- paddlex/modules/base/__init__.py +1 -1
- paddlex/modules/base/evaluator.py +5 -5
- paddlex/modules/base/trainer.py +1 -1
- paddlex/modules/doc_vlm/dataset_checker.py +2 -2
- paddlex/modules/doc_vlm/evaluator.py +2 -2
- paddlex/modules/doc_vlm/exportor.py +2 -2
- paddlex/modules/doc_vlm/model_list.py +1 -1
- paddlex/modules/doc_vlm/trainer.py +2 -2
- paddlex/modules/face_recognition/evaluator.py +2 -2
- paddlex/modules/formula_recognition/evaluator.py +5 -2
- paddlex/modules/formula_recognition/model_list.py +3 -0
- paddlex/modules/formula_recognition/trainer.py +3 -0
- paddlex/modules/general_recognition/evaluator.py +1 -1
- paddlex/modules/image_classification/evaluator.py +2 -2
- paddlex/modules/image_classification/model_list.py +1 -0
- paddlex/modules/instance_segmentation/evaluator.py +1 -1
- paddlex/modules/keypoint_detection/evaluator.py +1 -1
- paddlex/modules/m_3d_bev_detection/evaluator.py +2 -2
- paddlex/modules/multilabel_classification/evaluator.py +2 -2
- paddlex/modules/object_detection/dataset_checker/dataset_src/convert_dataset.py +4 -4
- paddlex/modules/object_detection/evaluator.py +2 -2
- paddlex/modules/object_detection/model_list.py +2 -0
- paddlex/modules/semantic_segmentation/dataset_checker/__init__.py +12 -2
- paddlex/modules/semantic_segmentation/evaluator.py +2 -2
- paddlex/modules/table_recognition/evaluator.py +2 -2
- paddlex/modules/text_detection/evaluator.py +2 -2
- paddlex/modules/text_detection/model_list.py +2 -0
- paddlex/modules/text_recognition/evaluator.py +2 -2
- paddlex/modules/text_recognition/model_list.py +2 -0
- paddlex/modules/ts_anomaly_detection/evaluator.py +2 -2
- paddlex/modules/ts_classification/dataset_checker/dataset_src/split_dataset.py +1 -1
- paddlex/modules/ts_classification/evaluator.py +2 -2
- paddlex/modules/ts_forecast/evaluator.py +2 -2
- paddlex/modules/video_classification/evaluator.py +2 -2
- paddlex/modules/video_detection/evaluator.py +2 -2
- paddlex/ops/__init__.py +8 -5
- paddlex/paddlex_cli.py +19 -13
- paddlex/repo_apis/Paddle3D_api/bev_fusion/model.py +2 -2
- paddlex/repo_apis/PaddleClas_api/cls/config.py +1 -1
- paddlex/repo_apis/PaddleClas_api/cls/model.py +1 -1
- paddlex/repo_apis/PaddleClas_api/cls/register.py +10 -0
- paddlex/repo_apis/PaddleClas_api/cls/runner.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/instance_seg/model.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/instance_seg/runner.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/config.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/model.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/official_categories.py +25 -0
- paddlex/repo_apis/PaddleDetection_api/object_det/register.py +30 -0
- paddlex/repo_apis/PaddleDetection_api/object_det/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/formula_rec/config.py +3 -3
- paddlex/repo_apis/PaddleOCR_api/formula_rec/model.py +5 -9
- paddlex/repo_apis/PaddleOCR_api/formula_rec/register.py +27 -0
- paddlex/repo_apis/PaddleOCR_api/formula_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/table_rec/model.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/table_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_det/model.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_det/register.py +18 -0
- paddlex/repo_apis/PaddleOCR_api/text_det/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_rec/config.py +3 -3
- paddlex/repo_apis/PaddleOCR_api/text_rec/model.py +5 -9
- paddlex/repo_apis/PaddleOCR_api/text_rec/register.py +18 -0
- paddlex/repo_apis/PaddleOCR_api/text_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleSeg_api/seg/model.py +1 -1
- paddlex/repo_apis/PaddleSeg_api/seg/runner.py +1 -1
- paddlex/repo_apis/PaddleTS_api/ts_ad/config.py +3 -3
- paddlex/repo_apis/PaddleTS_api/ts_cls/config.py +2 -2
- paddlex/repo_apis/PaddleTS_api/ts_fc/config.py +4 -4
- paddlex/repo_apis/PaddleVideo_api/video_cls/config.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_cls/model.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_cls/runner.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/config.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/model.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/runner.py +1 -1
- paddlex/repo_apis/base/config.py +1 -1
- paddlex/repo_manager/core.py +3 -3
- paddlex/repo_manager/meta.py +6 -2
- paddlex/repo_manager/repo.py +17 -16
- paddlex/utils/custom_device_list.py +26 -2
- paddlex/utils/deps.py +3 -3
- paddlex/utils/device.py +5 -13
- paddlex/utils/env.py +4 -0
- paddlex/utils/flags.py +11 -4
- paddlex/utils/fonts/__init__.py +34 -4
- paddlex/utils/misc.py +1 -1
- paddlex/utils/subclass_register.py +2 -2
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/METADATA +349 -208
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/RECORD +240 -211
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/WHEEL +1 -1
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/entry_points.txt +1 -0
- {paddlex-3.0.0rc1.dist-info/licenses → paddlex-3.0.2.dist-info}/LICENSE +0 -0
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/top_level.txt +0 -0
paddlex/repo_manager/repo.py
CHANGED
@@ -28,7 +28,7 @@ from ..utils.install import (
|
|
28
28
|
install_packages_from_requirements_file,
|
29
29
|
uninstall_packages,
|
30
30
|
)
|
31
|
-
from .meta import REPO_DOWNLOAD_BASE, get_repo_meta
|
31
|
+
from .meta import REPO_DIST_NAMES, REPO_DOWNLOAD_BASE, get_repo_meta
|
32
32
|
from .utils import (
|
33
33
|
fetch_repo_using_git,
|
34
34
|
install_external_deps,
|
@@ -133,8 +133,10 @@ class PPRepository(object):
|
|
133
133
|
try:
|
134
134
|
pip_install_opts = ["--no-deps"]
|
135
135
|
if editable:
|
136
|
-
|
137
|
-
|
136
|
+
reqs = ["-e ."]
|
137
|
+
else:
|
138
|
+
reqs = ["."]
|
139
|
+
install_packages(reqs, pip_install_opts=pip_install_opts)
|
138
140
|
install_external_deps(self.name, self.root_dir)
|
139
141
|
finally:
|
140
142
|
if clean:
|
@@ -142,14 +144,16 @@ class PPRepository(object):
|
|
142
144
|
tmp_build_dir = "build"
|
143
145
|
if osp.exists(tmp_build_dir):
|
144
146
|
shutil.rmtree(tmp_build_dir)
|
145
|
-
for e in self.meta.get("
|
147
|
+
for e in self.meta.get("extra_pkgs", []):
|
146
148
|
if isinstance(e, tuple):
|
147
149
|
with switch_working_dir(osp.join(self.root_dir, e[0])):
|
150
|
+
pip_install_opts = ["--no-deps"]
|
151
|
+
if e[3]:
|
152
|
+
reqs = ["-e ."]
|
153
|
+
else:
|
154
|
+
reqs = ["."]
|
148
155
|
try:
|
149
|
-
pip_install_opts
|
150
|
-
if e[3]:
|
151
|
-
pip_install_opts.append("-e")
|
152
|
-
install_packages(["."], pip_install_opts=pip_install_opts)
|
156
|
+
install_packages(reqs, pip_install_opts=pip_install_opts)
|
153
157
|
finally:
|
154
158
|
if clean:
|
155
159
|
tmp_build_dir = "build"
|
@@ -159,9 +163,9 @@ class PPRepository(object):
|
|
159
163
|
def uninstall_packages(self):
|
160
164
|
"""uninstall_packages"""
|
161
165
|
pkgs = []
|
162
|
-
if self.install_pkg:
|
166
|
+
if self.meta["install_pkg"]:
|
163
167
|
pkgs.append(self.dist_name)
|
164
|
-
for e in self.meta.get("
|
168
|
+
for e in self.meta.get("extra_pkgs", []):
|
165
169
|
if isinstance(e, tuple):
|
166
170
|
pkgs.append(e[1])
|
167
171
|
uninstall_packages(pkgs)
|
@@ -206,7 +210,7 @@ class PPRepository(object):
|
|
206
210
|
"""get_deps"""
|
207
211
|
# Merge requirement files
|
208
212
|
req_list = [self.main_req_file]
|
209
|
-
for e in self.meta.get("
|
213
|
+
for e in self.meta.get("extra_pkgs", []):
|
210
214
|
if isinstance(e, tuple):
|
211
215
|
e = e[2] or osp.join(e[0], "requirements.txt")
|
212
216
|
req_list.append(e)
|
@@ -327,7 +331,7 @@ class RepositoryGroupInstaller(object):
|
|
327
331
|
|
328
332
|
def _sort_repos(self, repos, check_missing=False):
|
329
333
|
# We sort the repos to ensure that the dependencies precede the
|
330
|
-
#
|
334
|
+
# dependent in the list.
|
331
335
|
name_meta_pairs = []
|
332
336
|
for repo in repos:
|
333
337
|
name_meta_pairs.append((repo.name, repo.meta))
|
@@ -358,9 +362,6 @@ class RepositoryGroupInstaller(object):
|
|
358
362
|
return sorted_repos
|
359
363
|
|
360
364
|
def _normalize_deps(self, deps, headline=None):
|
361
|
-
repo_pkgs = set(
|
362
|
-
repo.dist_name for repo in self.repos if repo.dist_name is not None
|
363
|
-
)
|
364
365
|
lines = []
|
365
366
|
if headline is not None:
|
366
367
|
lines.append(headline)
|
@@ -376,7 +377,7 @@ class RepositoryGroupInstaller(object):
|
|
376
377
|
# If `line` is not an empty line or a comment, it must be a requirement specifier.
|
377
378
|
# Other forms may cause a parse error.
|
378
379
|
req = Requirement(line_s)
|
379
|
-
if req.name in
|
380
|
+
if req.name in REPO_DIST_NAMES:
|
380
381
|
# Skip repo packages
|
381
382
|
continue
|
382
383
|
elif req.name.replace("_", "-") in (
|
@@ -135,8 +135,6 @@ NPU_BLACKLIST = [
|
|
135
135
|
"whisper_base",
|
136
136
|
"whisper_tiny",
|
137
137
|
"UniMERNet",
|
138
|
-
"PP-FormulaNet-L",
|
139
|
-
"PP-FormulaNet-S",
|
140
138
|
]
|
141
139
|
|
142
140
|
XPU_WHITELIST = [
|
@@ -191,6 +189,32 @@ XPU_WHITELIST = [
|
|
191
189
|
"RLinear",
|
192
190
|
"NLinear",
|
193
191
|
"PicoDet_LCNet_x2_5_face",
|
192
|
+
"PP-LCNet_x1_0_doc_ori",
|
193
|
+
"UVDoc",
|
194
|
+
"PP-DocLayout-L",
|
195
|
+
"PP-DocLayout-M",
|
196
|
+
"PP-DocLayout-S",
|
197
|
+
"PP-DocLayout_plus-L",
|
198
|
+
"PP-DocBlockLayout",
|
199
|
+
"SLANeXt_wired",
|
200
|
+
"SLANeXt_wireless",
|
201
|
+
"PP-LCNet_x1_0_table_cls",
|
202
|
+
"RT-DETR-L_wired_table_cell_det",
|
203
|
+
"RT-DETR-L_wireless_table_cell_det",
|
204
|
+
"PP-OCRv4_server_seal_det",
|
205
|
+
"PP-OCRv4_mobile_seal_det",
|
206
|
+
"PP-OCRv5_server_rec",
|
207
|
+
"PP-OCRv5_mobile_rec",
|
208
|
+
"PPDocBee-2B",
|
209
|
+
"PPDocBee-7B",
|
210
|
+
"PP-FormulaNet-S",
|
211
|
+
"PP-FormulaNet-L",
|
212
|
+
"PP-FormulaNet-M",
|
213
|
+
"PP-FormulaNet_plus-M",
|
214
|
+
"PP-FormulaNet_plus-L",
|
215
|
+
"PP-OCRv5_server_det",
|
216
|
+
"PP-OCRv5_mobile_det",
|
217
|
+
"PP-Chart2Table",
|
194
218
|
]
|
195
219
|
|
196
220
|
GCU_WHITELIST = [
|
paddlex/utils/deps.py
CHANGED
@@ -73,7 +73,7 @@ def _get_dep_specs():
|
|
73
73
|
DEP_SPECS = _get_dep_specs()
|
74
74
|
|
75
75
|
|
76
|
-
def
|
76
|
+
def get_dep_version(dep):
|
77
77
|
try:
|
78
78
|
return importlib.metadata.version(dep)
|
79
79
|
except importlib.metadata.PackageNotFoundError:
|
@@ -101,7 +101,7 @@ def is_dep_available(dep, /, check_version=None):
|
|
101
101
|
check_version = True
|
102
102
|
else:
|
103
103
|
check_version = False
|
104
|
-
version =
|
104
|
+
version = get_dep_version(dep)
|
105
105
|
if version is None:
|
106
106
|
return False
|
107
107
|
if check_version:
|
@@ -246,4 +246,4 @@ def require_paddle2onnx_plugin():
|
|
246
246
|
|
247
247
|
|
248
248
|
def get_paddle2onnx_spec():
|
249
|
-
return "paddle2onnx
|
249
|
+
return "paddle2onnx == 2.0.2rc3"
|
paddlex/utils/device.py
CHANGED
@@ -15,8 +15,6 @@
|
|
15
15
|
import os
|
16
16
|
from contextlib import ContextDecorator
|
17
17
|
|
18
|
-
import GPUtil
|
19
|
-
|
20
18
|
from . import logging
|
21
19
|
from .custom_device_list import (
|
22
20
|
DCU_WHITELIST,
|
@@ -41,18 +39,12 @@ def constr_device(device_type, device_ids):
|
|
41
39
|
|
42
40
|
|
43
41
|
def get_default_device():
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
avail_gpus = [0]
|
49
|
-
logging.info(
|
50
|
-
"Detected that the current device is a Jetson edge device. The default behavior will be to use GPU: 0"
|
51
|
-
)
|
52
|
-
if not avail_gpus:
|
53
|
-
return "cpu"
|
42
|
+
import paddle
|
43
|
+
|
44
|
+
if paddle.device.is_compiled_with_cuda() and paddle.device.cuda.device_count() > 0:
|
45
|
+
return constr_device("gpu", [0])
|
54
46
|
else:
|
55
|
-
return
|
47
|
+
return "cpu"
|
56
48
|
|
57
49
|
|
58
50
|
def parse_device(device):
|
paddlex/utils/env.py
CHANGED
@@ -41,6 +41,8 @@ def get_paddle_cuda_version():
|
|
41
41
|
import paddle.version
|
42
42
|
|
43
43
|
cuda_version = paddle.version.cuda()
|
44
|
+
if cuda_version == "False":
|
45
|
+
return None
|
44
46
|
return tuple(map(int, cuda_version.split(".")))
|
45
47
|
|
46
48
|
|
@@ -48,6 +50,8 @@ def get_paddle_cudnn_version():
|
|
48
50
|
import paddle.version
|
49
51
|
|
50
52
|
cudnn_version = paddle.version.cudnn()
|
53
|
+
if cudnn_version == "False":
|
54
|
+
return None
|
51
55
|
return tuple(map(int, cudnn_version.split(".")))
|
52
56
|
|
53
57
|
|
paddlex/utils/flags.py
CHANGED
@@ -24,7 +24,6 @@ __all__ = [
|
|
24
24
|
"INFER_BENCHMARK_ITERS",
|
25
25
|
"INFER_BENCHMARK_WARMUP",
|
26
26
|
"INFER_BENCHMARK_OUTPUT_DIR",
|
27
|
-
"INFER_BENCHMARK_USE_NEW_INFER_API",
|
28
27
|
"FLAGS_json_format_model",
|
29
28
|
"USE_PIR_TRT",
|
30
29
|
"DISABLE_DEV_MODEL_WL",
|
@@ -52,6 +51,17 @@ FLAGS_json_format_model = get_flag_from_env_var("FLAGS_json_format_model", True)
|
|
52
51
|
USE_PIR_TRT = get_flag_from_env_var("PADDLE_PDX_USE_PIR_TRT", True)
|
53
52
|
DISABLE_DEV_MODEL_WL = get_flag_from_env_var("PADDLE_PDX_DISABLE_DEV_MODEL_WL", False)
|
54
53
|
DISABLE_CINN_MODEL_WL = get_flag_from_env_var("PADDLE_PDX_DISABLE_CINN_MODEL_WL", False)
|
54
|
+
DISABLE_TRT_MODEL_BL = get_flag_from_env_var("PADDLE_PDX_DISABLE_TRT_MODEL_BL", False)
|
55
|
+
DISABLE_MKLDNN_MODEL_BL = get_flag_from_env_var(
|
56
|
+
"PADDLE_PDX_DISABLE_MKLDNN_MODEL_BL", False
|
57
|
+
)
|
58
|
+
LOCAL_FONT_FILE_PATH = get_flag_from_env_var("PADDLE_PDX_LOCAL_FONT_FILE_PATH", None)
|
59
|
+
ENABLE_MKLDNN_BYDEFAULT = get_flag_from_env_var(
|
60
|
+
"PADDLE_PDX_ENABLE_MKLDNN_BYDEFAULT", True
|
61
|
+
)
|
62
|
+
|
63
|
+
MODEL_SOURCE = os.environ.get("PADDLE_PDX_MODEL_SOURCE", "huggingface")
|
64
|
+
|
55
65
|
|
56
66
|
# Inference Benchmark
|
57
67
|
INFER_BENCHMARK = get_flag_from_env_var("PADDLE_PDX_INFER_BENCHMARK", False)
|
@@ -67,6 +77,3 @@ INFER_BENCHMARK_ITERS = get_flag_from_env_var(
|
|
67
77
|
INFER_BENCHMARK_USE_CACHE_FOR_READ = get_flag_from_env_var(
|
68
78
|
"PADDLE_PDX_INFER_BENCHMARK_USE_CACHE_FOR_READ", False
|
69
79
|
)
|
70
|
-
INFER_BENCHMARK_USE_NEW_INFER_API = get_flag_from_env_var(
|
71
|
-
"PADDLE_PDX_INFER_BENCHMARK_USE_NEW_INFER_API", False
|
72
|
-
)
|
paddlex/utils/fonts/__init__.py
CHANGED
@@ -18,7 +18,9 @@ import PIL
|
|
18
18
|
from PIL import ImageFont
|
19
19
|
|
20
20
|
from .. import logging
|
21
|
+
from ..cache import CACHE_DIR
|
21
22
|
from ..download import download
|
23
|
+
from ..flags import LOCAL_FONT_FILE_PATH
|
22
24
|
|
23
25
|
|
24
26
|
def get_font_file_path(file_name: str) -> str:
|
@@ -28,8 +30,8 @@ def get_font_file_path(file_name: str) -> str:
|
|
28
30
|
Returns:
|
29
31
|
str: The path to the font file.
|
30
32
|
"""
|
31
|
-
font_path = (Path(
|
32
|
-
if not Path(font_path).
|
33
|
+
font_path = (Path(CACHE_DIR) / "fonts" / file_name).resolve().as_posix()
|
34
|
+
if not Path(font_path).is_file():
|
33
35
|
download(
|
34
36
|
url=f"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/fonts/{file_name}",
|
35
37
|
save_path=font_path,
|
@@ -64,5 +66,33 @@ def create_font(txt: str, sz: tuple, font_path: str) -> ImageFont:
|
|
64
66
|
return font
|
65
67
|
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
def create_font_vertical(
|
70
|
+
txt: str, sz: tuple, font_path: str, scale=1.2
|
71
|
+
) -> ImageFont.FreeTypeFont:
|
72
|
+
n = len(txt) if len(txt) > 0 else 1
|
73
|
+
base_font_size = int(sz[1] / n * 0.8 * scale)
|
74
|
+
base_font_size = max(base_font_size, 10)
|
75
|
+
font = ImageFont.truetype(font_path, base_font_size, encoding="utf-8")
|
76
|
+
|
77
|
+
if int(PIL.__version__.split(".")[0]) < 10:
|
78
|
+
max_char_width = max([font.getsize(c)[0] for c in txt])
|
79
|
+
else:
|
80
|
+
max_char_width = max([font.getlength(c) for c in txt])
|
81
|
+
|
82
|
+
if max_char_width > sz[0]:
|
83
|
+
new_size = int(base_font_size * sz[0] / max_char_width)
|
84
|
+
new_size = max(new_size, 10)
|
85
|
+
font = ImageFont.truetype(font_path, new_size, encoding="utf-8")
|
86
|
+
|
87
|
+
return font
|
88
|
+
|
89
|
+
|
90
|
+
if Path(str(LOCAL_FONT_FILE_PATH)).is_file():
|
91
|
+
logging.warning(
|
92
|
+
f"Using the local font file(`{LOCAL_FONT_FILE_PATH}`) specified by `LOCAL_FONT_FILE_PATH`!"
|
93
|
+
)
|
94
|
+
PINGFANG_FONT_FILE_PATH = LOCAL_FONT_FILE_PATH
|
95
|
+
SIMFANG_FONT_FILE_PATH = LOCAL_FONT_FILE_PATH
|
96
|
+
else:
|
97
|
+
PINGFANG_FONT_FILE_PATH = get_font_file_path("PingFang-SC-Regular.ttf")
|
98
|
+
SIMFANG_FONT_FILE_PATH = get_font_file_path("simfang.ttf")
|
paddlex/utils/misc.py
CHANGED
@@ -46,7 +46,7 @@ class AutoRegisterMetaClass(type):
|
|
46
46
|
if bases:
|
47
47
|
for base in bases:
|
48
48
|
base_cls = mcs.__find_base_class(base)
|
49
|
-
if base_cls:
|
49
|
+
if base_cls and hasattr(cls, mcs.__model_type_attr_name):
|
50
50
|
mcs.__register_to_base_class(base_cls, cls)
|
51
51
|
|
52
52
|
@classmethod
|
@@ -64,7 +64,7 @@ class AutoRegisterMetaClass(type):
|
|
64
64
|
|
65
65
|
@classmethod
|
66
66
|
def __register_to_base_class(mcs, base, cls):
|
67
|
-
cls_entity_name = getattr(cls, mcs.__model_type_attr_name
|
67
|
+
cls_entity_name = getattr(cls, mcs.__model_type_attr_name)
|
68
68
|
if isinstance(cls_entity_name, str):
|
69
69
|
cls_entity_name = [cls_entity_name]
|
70
70
|
|