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.
Files changed (240) hide show
  1. paddlex/.version +1 -1
  2. paddlex/__init__.py +1 -1
  3. paddlex/configs/modules/chart_parsing/PP-Chart2Table.yaml +13 -0
  4. paddlex/configs/modules/doc_vlm/PP-DocBee2-3B.yaml +14 -0
  5. paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-L.yaml +40 -0
  6. paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-M.yaml +40 -0
  7. paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-S.yaml +40 -0
  8. paddlex/configs/modules/layout_detection/PP-DocBlockLayout.yaml +40 -0
  9. paddlex/configs/modules/layout_detection/PP-DocLayout-L.yaml +2 -2
  10. paddlex/configs/modules/layout_detection/PP-DocLayout-M.yaml +2 -2
  11. paddlex/configs/modules/layout_detection/PP-DocLayout-S.yaml +2 -2
  12. paddlex/configs/modules/layout_detection/PP-DocLayout_plus-L.yaml +40 -0
  13. paddlex/configs/modules/text_detection/PP-OCRv5_mobile_det.yaml +40 -0
  14. paddlex/configs/modules/text_detection/PP-OCRv5_server_det.yaml +40 -0
  15. paddlex/configs/modules/text_recognition/PP-OCRv5_mobile_rec.yaml +39 -0
  16. paddlex/configs/modules/text_recognition/PP-OCRv5_server_rec.yaml +39 -0
  17. paddlex/configs/modules/textline_orientation/PP-LCNet_x1_0_textline_ori.yaml +41 -0
  18. paddlex/configs/pipelines/OCR.yaml +7 -6
  19. paddlex/configs/pipelines/PP-ChatOCRv3-doc.yaml +3 -1
  20. paddlex/configs/pipelines/PP-ChatOCRv4-doc.yaml +91 -34
  21. paddlex/configs/pipelines/PP-StructureV3.yaml +72 -72
  22. paddlex/configs/pipelines/doc_understanding.yaml +1 -1
  23. paddlex/configs/pipelines/formula_recognition.yaml +2 -2
  24. paddlex/configs/pipelines/layout_parsing.yaml +3 -2
  25. paddlex/configs/pipelines/seal_recognition.yaml +1 -0
  26. paddlex/configs/pipelines/table_recognition.yaml +2 -1
  27. paddlex/configs/pipelines/table_recognition_v2.yaml +7 -1
  28. paddlex/hpip_links.html +20 -20
  29. paddlex/inference/common/batch_sampler/doc_vlm_batch_sampler.py +33 -10
  30. paddlex/inference/common/batch_sampler/image_batch_sampler.py +34 -25
  31. paddlex/inference/common/result/mixin.py +19 -12
  32. paddlex/inference/models/base/predictor/base_predictor.py +2 -8
  33. paddlex/inference/models/common/static_infer.py +29 -73
  34. paddlex/inference/models/common/tokenizer/__init__.py +2 -0
  35. paddlex/inference/models/common/tokenizer/clip_tokenizer.py +1 -1
  36. paddlex/inference/models/common/tokenizer/gpt_tokenizer.py +2 -2
  37. paddlex/inference/models/common/tokenizer/qwen2_5_tokenizer.py +112 -0
  38. paddlex/inference/models/common/tokenizer/qwen2_tokenizer.py +7 -1
  39. paddlex/inference/models/common/tokenizer/qwen_tokenizer.py +288 -0
  40. paddlex/inference/models/common/tokenizer/tokenizer_utils.py +13 -13
  41. paddlex/inference/models/common/tokenizer/tokenizer_utils_base.py +3 -3
  42. paddlex/inference/models/common/tokenizer/vocab.py +7 -7
  43. paddlex/inference/models/common/ts/funcs.py +19 -8
  44. paddlex/inference/models/common/vlm/conversion_utils.py +99 -0
  45. paddlex/inference/models/common/vlm/fusion_ops.py +205 -0
  46. paddlex/inference/models/common/vlm/generation/configuration_utils.py +1 -1
  47. paddlex/inference/models/common/vlm/generation/logits_process.py +1 -1
  48. paddlex/inference/models/common/vlm/generation/utils.py +1 -1
  49. paddlex/inference/models/common/vlm/transformers/configuration_utils.py +3 -3
  50. paddlex/inference/models/common/vlm/transformers/conversion_utils.py +3 -3
  51. paddlex/inference/models/common/vlm/transformers/model_outputs.py +2 -2
  52. paddlex/inference/models/common/vlm/transformers/model_utils.py +7 -31
  53. paddlex/inference/models/doc_vlm/modeling/GOT_ocr_2_0.py +830 -0
  54. paddlex/inference/models/doc_vlm/modeling/__init__.py +2 -0
  55. paddlex/inference/models/doc_vlm/modeling/qwen2.py +1606 -0
  56. paddlex/inference/models/doc_vlm/modeling/qwen2_5_vl.py +3006 -0
  57. paddlex/inference/models/doc_vlm/modeling/qwen2_vl.py +0 -105
  58. paddlex/inference/models/doc_vlm/predictor.py +79 -24
  59. paddlex/inference/models/doc_vlm/processors/GOT_ocr_2_0.py +97 -0
  60. paddlex/inference/models/doc_vlm/processors/__init__.py +2 -0
  61. paddlex/inference/models/doc_vlm/processors/common.py +189 -0
  62. paddlex/inference/models/doc_vlm/processors/qwen2_5_vl.py +548 -0
  63. paddlex/inference/models/doc_vlm/processors/qwen2_vl.py +21 -176
  64. paddlex/inference/models/formula_recognition/predictor.py +8 -2
  65. paddlex/inference/models/formula_recognition/processors.py +90 -77
  66. paddlex/inference/models/formula_recognition/result.py +28 -27
  67. paddlex/inference/models/image_feature/processors.py +3 -4
  68. paddlex/inference/models/keypoint_detection/predictor.py +3 -0
  69. paddlex/inference/models/object_detection/predictor.py +2 -0
  70. paddlex/inference/models/object_detection/processors.py +28 -3
  71. paddlex/inference/models/object_detection/utils.py +2 -0
  72. paddlex/inference/models/table_structure_recognition/result.py +0 -10
  73. paddlex/inference/models/text_detection/predictor.py +8 -0
  74. paddlex/inference/models/text_detection/processors.py +44 -10
  75. paddlex/inference/models/text_detection/result.py +0 -10
  76. paddlex/inference/models/text_recognition/result.py +1 -1
  77. paddlex/inference/pipelines/__init__.py +9 -5
  78. paddlex/inference/pipelines/_parallel.py +172 -0
  79. paddlex/inference/pipelines/anomaly_detection/pipeline.py +16 -6
  80. paddlex/inference/pipelines/attribute_recognition/pipeline.py +11 -1
  81. paddlex/inference/pipelines/base.py +14 -4
  82. paddlex/inference/pipelines/components/faisser.py +1 -1
  83. paddlex/inference/pipelines/doc_preprocessor/pipeline.py +53 -27
  84. paddlex/inference/pipelines/formula_recognition/pipeline.py +120 -82
  85. paddlex/inference/pipelines/formula_recognition/result.py +1 -11
  86. paddlex/inference/pipelines/image_classification/pipeline.py +16 -6
  87. paddlex/inference/pipelines/image_multilabel_classification/pipeline.py +16 -6
  88. paddlex/inference/pipelines/instance_segmentation/pipeline.py +16 -6
  89. paddlex/inference/pipelines/keypoint_detection/pipeline.py +16 -6
  90. paddlex/inference/pipelines/layout_parsing/layout_objects.py +859 -0
  91. paddlex/inference/pipelines/layout_parsing/pipeline.py +34 -47
  92. paddlex/inference/pipelines/layout_parsing/pipeline_v2.py +832 -260
  93. paddlex/inference/pipelines/layout_parsing/result.py +4 -17
  94. paddlex/inference/pipelines/layout_parsing/result_v2.py +259 -245
  95. paddlex/inference/pipelines/layout_parsing/setting.py +88 -0
  96. paddlex/inference/pipelines/layout_parsing/utils.py +391 -2028
  97. paddlex/inference/pipelines/layout_parsing/xycut_enhanced/__init__.py +16 -0
  98. paddlex/inference/pipelines/layout_parsing/xycut_enhanced/utils.py +1199 -0
  99. paddlex/inference/pipelines/layout_parsing/xycut_enhanced/xycuts.py +615 -0
  100. paddlex/inference/pipelines/m_3d_bev_detection/pipeline.py +2 -2
  101. paddlex/inference/pipelines/multilingual_speech_recognition/pipeline.py +2 -2
  102. paddlex/inference/pipelines/object_detection/pipeline.py +16 -6
  103. paddlex/inference/pipelines/ocr/pipeline.py +127 -70
  104. paddlex/inference/pipelines/ocr/result.py +21 -18
  105. paddlex/inference/pipelines/open_vocabulary_detection/pipeline.py +2 -2
  106. paddlex/inference/pipelines/open_vocabulary_segmentation/pipeline.py +2 -2
  107. paddlex/inference/pipelines/pp_chatocr/pipeline_base.py +2 -2
  108. paddlex/inference/pipelines/pp_chatocr/pipeline_v3.py +2 -5
  109. paddlex/inference/pipelines/pp_chatocr/pipeline_v4.py +6 -6
  110. paddlex/inference/pipelines/rotated_object_detection/pipeline.py +16 -6
  111. paddlex/inference/pipelines/seal_recognition/pipeline.py +109 -53
  112. paddlex/inference/pipelines/semantic_segmentation/pipeline.py +16 -6
  113. paddlex/inference/pipelines/small_object_detection/pipeline.py +16 -6
  114. paddlex/inference/pipelines/table_recognition/pipeline.py +26 -18
  115. paddlex/inference/pipelines/table_recognition/pipeline_v2.py +624 -53
  116. paddlex/inference/pipelines/table_recognition/result.py +1 -1
  117. paddlex/inference/pipelines/table_recognition/table_recognition_post_processing_v2.py +9 -5
  118. paddlex/inference/pipelines/ts_anomaly_detection/pipeline.py +2 -2
  119. paddlex/inference/pipelines/ts_classification/pipeline.py +2 -2
  120. paddlex/inference/pipelines/ts_forecasting/pipeline.py +2 -2
  121. paddlex/inference/pipelines/video_classification/pipeline.py +2 -2
  122. paddlex/inference/pipelines/video_detection/pipeline.py +2 -2
  123. paddlex/inference/serving/basic_serving/_app.py +46 -13
  124. paddlex/inference/serving/basic_serving/_pipeline_apps/_common/common.py +5 -1
  125. paddlex/inference/serving/basic_serving/_pipeline_apps/layout_parsing.py +0 -1
  126. paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv3_doc.py +0 -1
  127. paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv4_doc.py +1 -1
  128. paddlex/inference/serving/basic_serving/_pipeline_apps/pp_structurev3.py +6 -2
  129. paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition.py +1 -5
  130. paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition_v2.py +4 -5
  131. paddlex/inference/serving/infra/utils.py +20 -22
  132. paddlex/inference/serving/schemas/formula_recognition.py +1 -1
  133. paddlex/inference/serving/schemas/layout_parsing.py +1 -2
  134. paddlex/inference/serving/schemas/pp_chatocrv3_doc.py +1 -2
  135. paddlex/inference/serving/schemas/pp_chatocrv4_doc.py +2 -2
  136. paddlex/inference/serving/schemas/pp_structurev3.py +10 -6
  137. paddlex/inference/serving/schemas/seal_recognition.py +1 -1
  138. paddlex/inference/serving/schemas/table_recognition.py +2 -6
  139. paddlex/inference/serving/schemas/table_recognition_v2.py +5 -6
  140. paddlex/inference/utils/hpi.py +30 -16
  141. paddlex/inference/utils/hpi_model_info_collection.json +666 -162
  142. paddlex/inference/utils/io/readers.py +12 -12
  143. paddlex/inference/utils/misc.py +20 -0
  144. paddlex/inference/utils/mkldnn_blocklist.py +59 -0
  145. paddlex/inference/utils/official_models.py +140 -5
  146. paddlex/inference/utils/pp_option.py +74 -9
  147. paddlex/model.py +2 -2
  148. paddlex/modules/__init__.py +1 -1
  149. paddlex/modules/anomaly_detection/evaluator.py +2 -2
  150. paddlex/modules/base/__init__.py +1 -1
  151. paddlex/modules/base/evaluator.py +5 -5
  152. paddlex/modules/base/trainer.py +1 -1
  153. paddlex/modules/doc_vlm/dataset_checker.py +2 -2
  154. paddlex/modules/doc_vlm/evaluator.py +2 -2
  155. paddlex/modules/doc_vlm/exportor.py +2 -2
  156. paddlex/modules/doc_vlm/model_list.py +1 -1
  157. paddlex/modules/doc_vlm/trainer.py +2 -2
  158. paddlex/modules/face_recognition/evaluator.py +2 -2
  159. paddlex/modules/formula_recognition/evaluator.py +5 -2
  160. paddlex/modules/formula_recognition/model_list.py +3 -0
  161. paddlex/modules/formula_recognition/trainer.py +3 -0
  162. paddlex/modules/general_recognition/evaluator.py +1 -1
  163. paddlex/modules/image_classification/evaluator.py +2 -2
  164. paddlex/modules/image_classification/model_list.py +1 -0
  165. paddlex/modules/instance_segmentation/evaluator.py +1 -1
  166. paddlex/modules/keypoint_detection/evaluator.py +1 -1
  167. paddlex/modules/m_3d_bev_detection/evaluator.py +2 -2
  168. paddlex/modules/multilabel_classification/evaluator.py +2 -2
  169. paddlex/modules/object_detection/dataset_checker/dataset_src/convert_dataset.py +4 -4
  170. paddlex/modules/object_detection/evaluator.py +2 -2
  171. paddlex/modules/object_detection/model_list.py +2 -0
  172. paddlex/modules/semantic_segmentation/dataset_checker/__init__.py +12 -2
  173. paddlex/modules/semantic_segmentation/evaluator.py +2 -2
  174. paddlex/modules/table_recognition/evaluator.py +2 -2
  175. paddlex/modules/text_detection/evaluator.py +2 -2
  176. paddlex/modules/text_detection/model_list.py +2 -0
  177. paddlex/modules/text_recognition/evaluator.py +2 -2
  178. paddlex/modules/text_recognition/model_list.py +2 -0
  179. paddlex/modules/ts_anomaly_detection/evaluator.py +2 -2
  180. paddlex/modules/ts_classification/dataset_checker/dataset_src/split_dataset.py +1 -1
  181. paddlex/modules/ts_classification/evaluator.py +2 -2
  182. paddlex/modules/ts_forecast/evaluator.py +2 -2
  183. paddlex/modules/video_classification/evaluator.py +2 -2
  184. paddlex/modules/video_detection/evaluator.py +2 -2
  185. paddlex/ops/__init__.py +8 -5
  186. paddlex/paddlex_cli.py +19 -13
  187. paddlex/repo_apis/Paddle3D_api/bev_fusion/model.py +2 -2
  188. paddlex/repo_apis/PaddleClas_api/cls/config.py +1 -1
  189. paddlex/repo_apis/PaddleClas_api/cls/model.py +1 -1
  190. paddlex/repo_apis/PaddleClas_api/cls/register.py +10 -0
  191. paddlex/repo_apis/PaddleClas_api/cls/runner.py +1 -1
  192. paddlex/repo_apis/PaddleDetection_api/instance_seg/model.py +1 -1
  193. paddlex/repo_apis/PaddleDetection_api/instance_seg/runner.py +1 -1
  194. paddlex/repo_apis/PaddleDetection_api/object_det/config.py +1 -1
  195. paddlex/repo_apis/PaddleDetection_api/object_det/model.py +1 -1
  196. paddlex/repo_apis/PaddleDetection_api/object_det/official_categories.py +25 -0
  197. paddlex/repo_apis/PaddleDetection_api/object_det/register.py +30 -0
  198. paddlex/repo_apis/PaddleDetection_api/object_det/runner.py +1 -1
  199. paddlex/repo_apis/PaddleOCR_api/formula_rec/config.py +3 -3
  200. paddlex/repo_apis/PaddleOCR_api/formula_rec/model.py +5 -9
  201. paddlex/repo_apis/PaddleOCR_api/formula_rec/register.py +27 -0
  202. paddlex/repo_apis/PaddleOCR_api/formula_rec/runner.py +1 -1
  203. paddlex/repo_apis/PaddleOCR_api/table_rec/model.py +1 -1
  204. paddlex/repo_apis/PaddleOCR_api/table_rec/runner.py +1 -1
  205. paddlex/repo_apis/PaddleOCR_api/text_det/model.py +1 -1
  206. paddlex/repo_apis/PaddleOCR_api/text_det/register.py +18 -0
  207. paddlex/repo_apis/PaddleOCR_api/text_det/runner.py +1 -1
  208. paddlex/repo_apis/PaddleOCR_api/text_rec/config.py +3 -3
  209. paddlex/repo_apis/PaddleOCR_api/text_rec/model.py +5 -9
  210. paddlex/repo_apis/PaddleOCR_api/text_rec/register.py +18 -0
  211. paddlex/repo_apis/PaddleOCR_api/text_rec/runner.py +1 -1
  212. paddlex/repo_apis/PaddleSeg_api/seg/model.py +1 -1
  213. paddlex/repo_apis/PaddleSeg_api/seg/runner.py +1 -1
  214. paddlex/repo_apis/PaddleTS_api/ts_ad/config.py +3 -3
  215. paddlex/repo_apis/PaddleTS_api/ts_cls/config.py +2 -2
  216. paddlex/repo_apis/PaddleTS_api/ts_fc/config.py +4 -4
  217. paddlex/repo_apis/PaddleVideo_api/video_cls/config.py +1 -1
  218. paddlex/repo_apis/PaddleVideo_api/video_cls/model.py +1 -1
  219. paddlex/repo_apis/PaddleVideo_api/video_cls/runner.py +1 -1
  220. paddlex/repo_apis/PaddleVideo_api/video_det/config.py +1 -1
  221. paddlex/repo_apis/PaddleVideo_api/video_det/model.py +1 -1
  222. paddlex/repo_apis/PaddleVideo_api/video_det/runner.py +1 -1
  223. paddlex/repo_apis/base/config.py +1 -1
  224. paddlex/repo_manager/core.py +3 -3
  225. paddlex/repo_manager/meta.py +6 -2
  226. paddlex/repo_manager/repo.py +17 -16
  227. paddlex/utils/custom_device_list.py +26 -2
  228. paddlex/utils/deps.py +3 -3
  229. paddlex/utils/device.py +5 -13
  230. paddlex/utils/env.py +4 -0
  231. paddlex/utils/flags.py +11 -4
  232. paddlex/utils/fonts/__init__.py +34 -4
  233. paddlex/utils/misc.py +1 -1
  234. paddlex/utils/subclass_register.py +2 -2
  235. {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/METADATA +349 -208
  236. {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/RECORD +240 -211
  237. {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/WHEEL +1 -1
  238. {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/entry_points.txt +1 -0
  239. {paddlex-3.0.0rc1.dist-info/licenses → paddlex-3.0.2.dist-info}/LICENSE +0 -0
  240. {paddlex-3.0.0rc1.dist-info → paddlex-3.0.2.dist-info}/top_level.txt +0 -0
@@ -26,8 +26,8 @@ from ....utils.deps import class_requires_deps, is_dep_available
26
26
 
27
27
  if is_dep_available("opencv-contrib-python"):
28
28
  import cv2
29
- if is_dep_available("PyMuPDF"):
30
- import fitz
29
+ if is_dep_available("pypdfium2"):
30
+ import pypdfium2 as pdfium
31
31
  if is_dep_available("soundfile"):
32
32
  import soundfile
33
33
 
@@ -96,7 +96,7 @@ class _BaseReader(object):
96
96
  class PDFReader(_BaseReader):
97
97
  """PDFReader"""
98
98
 
99
- def __init__(self, backend="fitz", **bk_args):
99
+ def __init__(self, backend="pypdfium2", **bk_args):
100
100
  super().__init__(backend, **bk_args)
101
101
 
102
102
  def read(self, in_path):
@@ -244,19 +244,19 @@ class PILImageReaderBackend(_ImageReaderBackend):
244
244
  return ImageOps.exif_transpose(Image.open(in_path))
245
245
 
246
246
 
247
- @class_requires_deps("PyMuPDF", "opencv-contrib-python")
247
+ @class_requires_deps("pypdfium2", "opencv-contrib-python")
248
248
  class PDFReaderBackend(_BaseReaderBackend):
249
249
 
250
- def __init__(self, rotate=0, zoom_x=2.0, zoom_y=2.0):
250
+ def __init__(self, rotate=0, zoom=2.0):
251
251
  super().__init__()
252
- self.mat = fitz.Matrix(zoom_x, zoom_y).prerotate(rotate)
252
+ self._rotation = rotate
253
+ self._scale = zoom
253
254
 
254
255
  def read_file(self, in_path):
255
- for page in fitz.open(in_path):
256
- pixmap = page.get_pixmap(matrix=self.mat, alpha=False)
257
- img_cv = np.frombuffer(pixmap.samples, dtype=np.uint8).reshape(
258
- pixmap.h, pixmap.w, pixmap.n
259
- )
256
+ for page in pdfium.PdfDocument(in_path):
257
+ image = page.render(scale=self._scale, rotation=self._rotation).to_pil()
258
+ image = image.convert("RGB")
259
+ img_cv = np.array(image)
260
260
  img_cv = cv2.cvtColor(img_cv, cv2.COLOR_RGB2BGR)
261
261
  yield img_cv
262
262
 
@@ -361,7 +361,7 @@ class DecordVideoReaderBackend(_VideoReaderBackend):
361
361
  self.valid_mode = True
362
362
  self._fps = 0
363
363
 
364
- # XXX(gaotingquan): There is a confict with `paddle` when import `decord` globally.
364
+ # XXX(gaotingquan): There is a conflict with `paddle` when import `decord` globally.
365
365
  try:
366
366
  import decord
367
367
 
@@ -0,0 +1,20 @@
1
+ # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ def is_mkldnn_available():
17
+ # XXX: Not sure if this is the best way to check if MKL-DNN is available
18
+ from paddle.inference import Config
19
+
20
+ return hasattr(Config, "set_mkldnn_cache_capacity")
@@ -0,0 +1,59 @@
1
+ # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ MKLDNN_BLOCKLIST = [
16
+ "LaTeX_OCR_rec",
17
+ "PP-FormulaNet-L",
18
+ "PP-FormulaNet-S",
19
+ "UniMERNet",
20
+ "UVDoc",
21
+ "Cascade-MaskRCNN-ResNet50-FPN",
22
+ "Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN",
23
+ "Mask-RT-DETR-M",
24
+ "Mask-RT-DETR-S",
25
+ "MaskRCNN-ResNeXt101-vd-FPN",
26
+ "MaskRCNN-ResNet101-FPN",
27
+ "MaskRCNN-ResNet101-vd-FPN",
28
+ "MaskRCNN-ResNet50-FPN",
29
+ "MaskRCNN-ResNet50-vd-FPN",
30
+ "MaskRCNN-ResNet50",
31
+ "SOLOv2",
32
+ "PP-TinyPose_128x96",
33
+ "PP-TinyPose_256x192",
34
+ "Cascade-FasterRCNN-ResNet50-FPN",
35
+ "Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN",
36
+ "Co-DINO-Swin-L",
37
+ "Co-Deformable-DETR-Swin-T",
38
+ "FasterRCNN-ResNeXt101-vd-FPN",
39
+ "FasterRCNN-ResNet101-FPN",
40
+ "FasterRCNN-ResNet101",
41
+ "FasterRCNN-ResNet34-FPN",
42
+ "FasterRCNN-ResNet50-FPN",
43
+ "FasterRCNN-ResNet50-vd-FPN",
44
+ "FasterRCNN-ResNet50-vd-SSLDv2-FPN",
45
+ "FasterRCNN-ResNet50",
46
+ "FasterRCNN-Swin-Tiny-FPN",
47
+ "MaskFormer_small",
48
+ "MaskFormer_tiny",
49
+ "SLANeXt_wired",
50
+ "SLANeXt_wireless",
51
+ "SLANet",
52
+ "SLANet_plus",
53
+ "YOWO",
54
+ "SAM-H_box",
55
+ "SAM-H_point",
56
+ "PP-FormulaNet_plus-L",
57
+ "PP-FormulaNet_plus-M",
58
+ "PP-FormulaNet_plus-S",
59
+ ]
@@ -12,11 +12,22 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import os
16
+ import shutil
17
+ import tempfile
18
+ from functools import lru_cache
15
19
  from pathlib import Path
16
20
 
21
+ import huggingface_hub as hf_hub
22
+
23
+ hf_hub.logging.set_verbosity_error()
24
+
25
+ import requests
26
+
17
27
  from ...utils import logging
18
28
  from ...utils.cache import CACHE_DIR
19
29
  from ...utils.download import download_and_extract
30
+ from ...utils.flags import MODEL_SOURCE
20
31
 
21
32
  OFFICIAL_MODELS = {
22
33
  "ResNet18": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/ResNet18_infer.tar",
@@ -37,6 +48,7 @@ OFFICIAL_MODELS = {
37
48
  "PP-LCNet_x0_75": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x0_75_infer.tar",
38
49
  "PP-LCNet_x1_0": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x1_0_infer.tar",
39
50
  "PP-LCNet_x1_0_doc_ori": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x1_0_doc_ori_infer.tar",
51
+ "PP-LCNet_x1_0_textline_ori": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x1_0_textline_ori_infer.tar",
40
52
  "PP-LCNet_x1_5": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x1_5_infer.tar",
41
53
  "PP-LCNet_x2_5": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x2_5_infer.tar",
42
54
  "PP-LCNet_x2_0": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-LCNet_x2_0_infer.tar",
@@ -250,6 +262,9 @@ PP-LCNet_x1_0_vehicle_attribute_infer.tar",
250
262
  "UniMERNet": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/UniMERNet_infer.tar",
251
263
  "PP-FormulaNet-S": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-FormulaNet-S_infer.tar",
252
264
  "PP-FormulaNet-L": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-FormulaNet-L_infer.tar",
265
+ "PP-FormulaNet_plus-S": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-FormulaNet_plus-S_infer.tar",
266
+ "PP-FormulaNet_plus-M": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-FormulaNet_plus-M_infer.tar",
267
+ "PP-FormulaNet_plus-L": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-FormulaNet_plus-L_infer.tar",
253
268
  "FasterRCNN-ResNet34-FPN": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/FasterRCNN-ResNet34-FPN_infer.tar",
254
269
  "FasterRCNN-ResNet50": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/FasterRCNN-ResNet50_infer.tar",
255
270
  "FasterRCNN-ResNet50-FPN": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/FasterRCNN-ResNet50-FPN_infer.tar",
@@ -331,24 +346,144 @@ PP-LCNet_x1_0_vehicle_attribute_infer.tar",
331
346
  "PP-DocLayout-L": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocLayout-L_infer.tar",
332
347
  "PP-DocLayout-M": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocLayout-M_infer.tar",
333
348
  "PP-DocLayout-S": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocLayout-S_infer.tar",
349
+ "PP-DocLayout_plus-L": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocLayout_plus-L_infer.tar",
350
+ "PP-DocBlockLayout": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocBlockLayout_infer.tar",
334
351
  "BEVFusion": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/BEVFusion_infer.tar",
335
352
  "YOLO-Worldv2-L": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/YOLO-Worldv2-L_infer.tar",
336
353
  "PP-DocBee-2B": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocBee-2B_infer.tar",
337
354
  "PP-DocBee-7B": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocBee-7B_infer.tar",
355
+ "PP-Chart2Table": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-Chart2Table_infer.tar",
356
+ "PP-OCRv5_server_det": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-OCRv5_server_det_infer.tar",
357
+ "PP-OCRv5_mobile_det": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-OCRv5_mobile_det_infer.tar",
358
+ "PP-OCRv5_server_rec": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/\
359
+ PP-OCRv5_server_rec_infer.tar",
360
+ "PP-OCRv5_mobile_rec": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/\
361
+ PP-OCRv5_mobile_rec_infer.tar",
362
+ "PP-DocBee2-3B": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-DocBee2-3B_infer.tar",
338
363
  }
339
364
 
340
365
 
366
+ HUGGINGFACE_MODELS = [
367
+ "arabic_PP-OCRv3_mobile_rec",
368
+ "chinese_cht_PP-OCRv3_mobile_rec",
369
+ "ch_RepSVTR_rec",
370
+ "ch_SVTRv2_rec",
371
+ "cyrillic_PP-OCRv3_mobile_rec",
372
+ "devanagari_PP-OCRv3_mobile_rec",
373
+ "en_PP-OCRv3_mobile_rec",
374
+ "en_PP-OCRv4_mobile_rec",
375
+ "japan_PP-OCRv3_mobile_rec",
376
+ "ka_PP-OCRv3_mobile_rec",
377
+ "korean_PP-OCRv3_mobile_rec",
378
+ "LaTeX_OCR_rec",
379
+ "latin_PP-OCRv3_mobile_rec",
380
+ "PicoDet_layout_1x",
381
+ "PicoDet_layout_1x_table",
382
+ "PicoDet-L_layout_17cls",
383
+ "PicoDet-L_layout_3cls",
384
+ "PicoDet-S_layout_17cls",
385
+ "PicoDet-S_layout_3cls",
386
+ "PP-DocBee2-3B",
387
+ "PP-DocBee-2B",
388
+ "PP-DocBee-7B",
389
+ "PP-DocBlockLayout",
390
+ "PP-DocLayout-L",
391
+ "PP-DocLayout-M",
392
+ "PP-DocLayout_plus-L",
393
+ "PP-DocLayout-S",
394
+ "PP-FormulaNet-L",
395
+ "PP-FormulaNet_plus-L",
396
+ "PP-FormulaNet_plus-M",
397
+ "PP-FormulaNet_plus-S",
398
+ "PP-FormulaNet-S",
399
+ "PP-LCNet_x1_0_doc_ori",
400
+ "PP-LCNet_x1_0_table_cls",
401
+ "PP-OCRv3_mobile_det",
402
+ "PP-OCRv3_mobile_rec",
403
+ "PP-OCRv3_server_det",
404
+ "PP-OCRv4_mobile_det",
405
+ "PP-OCRv4_mobile_rec",
406
+ "PP-OCRv4_mobile_seal_det",
407
+ "PP-OCRv4_server_det",
408
+ "PP-OCRv4_server_rec_doc",
409
+ "PP-OCRv4_server_rec",
410
+ "PP-OCRv4_server_seal_det",
411
+ "PP-OCRv5_mobile_det",
412
+ "PP-OCRv5_mobile_rec",
413
+ "PP-OCRv5_server_det",
414
+ "PP-OCRv5_server_rec",
415
+ "RT-DETR-H_layout_17cls",
416
+ "RT-DETR-H_layout_3cls",
417
+ "RT-DETR-L_wired_table_cell_det",
418
+ "RT-DETR-L_wireless_table_cell_det",
419
+ "SLANet",
420
+ "SLANet_plus",
421
+ "SLANeXt_wired",
422
+ "SLANeXt_wireless",
423
+ "ta_PP-OCRv3_mobile_rec",
424
+ "te_PP-OCRv3_mobile_rec",
425
+ "UniMERNet",
426
+ "UVDoc",
427
+ ]
428
+
429
+
430
+ @lru_cache(1)
431
+ def is_huggingface_accessible():
432
+ try:
433
+ response = requests.get("https://huggingface.co", timeout=1)
434
+ return response.ok == True
435
+ except requests.exceptions.RequestException as e:
436
+ return False
437
+
438
+
341
439
  class OfficialModelsDict(dict):
342
440
  """Official Models Dict"""
343
441
 
442
+ _save_dir = Path(CACHE_DIR) / "official_models"
443
+
344
444
  def __getitem__(self, key):
345
- url = super().__getitem__(key)
346
- save_dir = Path(CACHE_DIR) / "official_models"
445
+ def _download_from_bos():
446
+ url = super(OfficialModelsDict, self).__getitem__(key)
447
+ download_and_extract(url, self._save_dir, f"{key}", overwrite=False)
448
+ return self._save_dir / f"{key}"
449
+
450
+ def _download_from_hf():
451
+ local_dir = self._save_dir / f"{key}"
452
+ try:
453
+ if os.path.exists(local_dir):
454
+ hf_hub.snapshot_download(
455
+ repo_id=f"PaddlePaddle/{key}", local_dir=local_dir
456
+ )
457
+ else:
458
+ with tempfile.TemporaryDirectory() as td:
459
+ temp_dir = os.path.join(td, "temp_dir")
460
+ hf_hub.snapshot_download(
461
+ repo_id=f"PaddlePaddle/{key}", local_dir=temp_dir
462
+ )
463
+ shutil.move(temp_dir, local_dir)
464
+ except Exception as e:
465
+ logging.warning(
466
+ f"Encounter exception when download model from huggingface: \n{e}.\nPaddleX would try to download from BOS."
467
+ )
468
+ return _download_from_bos()
469
+ return local_dir
470
+
347
471
  logging.info(
348
- f"Using official model ({key}), the model files will be automatically downloaded and saved in {save_dir}."
472
+ f"Using official model ({key}), the model files will be automatically downloaded and saved in {self._save_dir}."
349
473
  )
350
- download_and_extract(url, save_dir, f"{key}", overwrite=False)
351
- return save_dir / f"{key}"
474
+
475
+ if (
476
+ MODEL_SOURCE.lower() == "huggingface"
477
+ and is_huggingface_accessible()
478
+ and key in HUGGINGFACE_MODELS
479
+ ):
480
+ return _download_from_hf()
481
+ elif MODEL_SOURCE.lower() == "modelscope":
482
+ raise Exception(
483
+ f"ModelScope is not supported! Please use `HuggingFace` or `BOS`."
484
+ )
485
+ else:
486
+ return _download_from_bos()
352
487
 
353
488
 
354
489
  official_models = OfficialModelsDict(OFFICIAL_MODELS)
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import os
16
+ from copy import deepcopy
16
17
  from typing import Dict, List
17
18
 
18
19
  from ...utils import logging
@@ -22,12 +23,34 @@ from ...utils.device import (
22
23
  parse_device,
23
24
  set_env_for_device_type,
24
25
  )
25
- from ...utils.flags import USE_PIR_TRT
26
+ from ...utils.flags import (
27
+ DISABLE_MKLDNN_MODEL_BL,
28
+ DISABLE_TRT_MODEL_BL,
29
+ ENABLE_MKLDNN_BYDEFAULT,
30
+ USE_PIR_TRT,
31
+ )
32
+ from .misc import is_mkldnn_available
33
+ from .mkldnn_blocklist import MKLDNN_BLOCKLIST
26
34
  from .new_ir_blocklist import NEWIR_BLOCKLIST
27
35
  from .trt_blocklist import TRT_BLOCKLIST
28
36
  from .trt_config import TRT_CFG_SETTING, TRT_PRECISION_MAP
29
37
 
30
38
 
39
+ def get_default_run_mode(model_name, device_type):
40
+ if not model_name:
41
+ return "paddle"
42
+ if device_type != "cpu":
43
+ return "paddle"
44
+ if (
45
+ ENABLE_MKLDNN_BYDEFAULT
46
+ and is_mkldnn_available()
47
+ and model_name not in MKLDNN_BLOCKLIST
48
+ ):
49
+ return "mkldnn"
50
+ else:
51
+ return "paddle"
52
+
53
+
31
54
  class PaddlePredictorOption(object):
32
55
  """Paddle Inference Engine Option"""
33
56
 
@@ -44,7 +67,7 @@ class PaddlePredictorOption(object):
44
67
  )
45
68
  SUPPORT_DEVICE = ("gpu", "cpu", "npu", "xpu", "mlu", "dcu", "gcu")
46
69
 
47
- def __init__(self, model_name, **kwargs):
70
+ def __init__(self, model_name=None, **kwargs):
48
71
  super().__init__()
49
72
  self._model_name = model_name
50
73
  self._cfg = {}
@@ -55,6 +78,10 @@ class PaddlePredictorOption(object):
55
78
  def model_name(self):
56
79
  return self._model_name
57
80
 
81
+ @model_name.setter
82
+ def model_name(self, model_name):
83
+ self._model_name = model_name
84
+
58
85
  @property
59
86
  def changed(self):
60
87
  return self._changed
@@ -64,6 +91,13 @@ class PaddlePredictorOption(object):
64
91
  assert isinstance(v, bool)
65
92
  self._changed = v
66
93
 
94
+ def copy(self):
95
+ obj = type(self)(self._model_name)
96
+ obj._cfg = deepcopy(self._cfg)
97
+ if hasattr(self, "trt_cfg_setting"):
98
+ obj.trt_cfg_setting = self.trt_cfg_setting
99
+ return obj
100
+
67
101
  def _init_option(self, **kwargs):
68
102
  for k, v in kwargs.items():
69
103
  if self._has_setter(k):
@@ -91,7 +125,7 @@ class PaddlePredictorOption(object):
91
125
  device_type, device_ids = parse_device(get_default_device())
92
126
 
93
127
  default_config = {
94
- "run_mode": "paddle",
128
+ "run_mode": get_default_run_mode(self.model_name, device_type),
95
129
  "device_type": device_type,
96
130
  "device_id": None if device_ids is None else device_ids[0],
97
131
  "cpu_threads": 8,
@@ -106,6 +140,7 @@ class PaddlePredictorOption(object):
106
140
  "trt_dynamic_shape_input_data": None, # only for trt
107
141
  "trt_shape_range_info_path": None, # only for trt
108
142
  "trt_allow_rebuild_at_runtime": True, # only for trt
143
+ "mkldnn_cache_capacity": 10,
109
144
  }
110
145
  return default_config
111
146
 
@@ -125,13 +160,35 @@ class PaddlePredictorOption(object):
125
160
  raise ValueError(
126
161
  f"`run_mode` must be {support_run_mode_str}, but received {repr(run_mode)}."
127
162
  )
128
- # TRT Blocklist
129
- if run_mode.startswith("trt") and self._model_name in TRT_BLOCKLIST:
130
- logging.warning(
131
- f"The model({self._model_name}) is not supported to run in trt mode! Using `paddle` instead!"
132
- )
163
+
164
+ if run_mode.startswith("mkldnn") and not is_mkldnn_available():
165
+ logging.warning("MKL-DNN is not available. Using `paddle` instead.")
133
166
  run_mode = "paddle"
134
167
 
168
+ # TODO: Check if trt is available
169
+
170
+ if self._model_name is not None:
171
+ # TRT Blocklist
172
+ if (
173
+ not DISABLE_TRT_MODEL_BL
174
+ and run_mode.startswith("trt")
175
+ and self._model_name in TRT_BLOCKLIST
176
+ ):
177
+ logging.warning(
178
+ f"The model({self._model_name}) is not supported to run in trt mode! Using `paddle` instead!"
179
+ )
180
+ run_mode = "paddle"
181
+ # MKLDNN Blocklist
182
+ elif (
183
+ not DISABLE_MKLDNN_MODEL_BL
184
+ and run_mode.startswith("mkldnn")
185
+ and self._model_name in MKLDNN_BLOCKLIST
186
+ ):
187
+ logging.warning(
188
+ f"The model({self._model_name}) is not supported to run in MKLDNN mode! Using `paddle` instead!"
189
+ )
190
+ run_mode = "paddle"
191
+
135
192
  self._update("run_mode", run_mode)
136
193
 
137
194
  @property
@@ -206,7 +263,7 @@ class PaddlePredictorOption(object):
206
263
  """set trt config"""
207
264
  assert isinstance(
208
265
  config, dict
209
- ), f"The trt_cfg_setting must be `dict` type, but recived `{type(config)}` type!"
266
+ ), f"The trt_cfg_setting must be `dict` type, but received `{type(config)}` type!"
210
267
  self._update("trt_cfg_setting", config)
211
268
 
212
269
  @property
@@ -273,6 +330,14 @@ class PaddlePredictorOption(object):
273
330
  def trt_allow_rebuild_at_runtime(self, trt_allow_rebuild_at_runtime):
274
331
  self._update("trt_allow_rebuild_at_runtime", trt_allow_rebuild_at_runtime)
275
332
 
333
+ @property
334
+ def mkldnn_cache_capacity(self):
335
+ return self._cfg["mkldnn_cache_capacity"]
336
+
337
+ @mkldnn_cache_capacity.setter
338
+ def mkldnn_cache_capacity(self, capacity: int):
339
+ self._update("mkldnn_cache_capacity", capacity)
340
+
276
341
  # For backward compatibility
277
342
  # TODO: Issue deprecation warnings
278
343
  @property
paddlex/model.py CHANGED
@@ -17,7 +17,7 @@ from copy import deepcopy
17
17
  from .inference import PaddlePredictorOption, create_predictor
18
18
  from .modules import (
19
19
  build_dataset_checker,
20
- build_evaluater,
20
+ build_evaluator,
21
21
  build_exportor,
22
22
  build_trainer,
23
23
  )
@@ -119,7 +119,7 @@ class _ModelBasedConfig(_BaseModel):
119
119
  trainer.train()
120
120
 
121
121
  def evaluate(self):
122
- evaluator = build_evaluater(self._config)
122
+ evaluator = build_evaluator(self._config)
123
123
  return evaluator.evaluate()
124
124
 
125
125
  def export(self):
@@ -14,7 +14,7 @@
14
14
  from importlib import import_module
15
15
 
16
16
  from .anomaly_detection import UadDatasetChecker, UadEvaluator, UadExportor, UadTrainer
17
- from .base import build_dataset_checker, build_evaluater, build_exportor, build_trainer
17
+ from .base import build_dataset_checker, build_evaluator, build_exportor, build_trainer
18
18
  from .face_recognition import (
19
19
  FaceRecDatasetChecker,
20
20
  FaceRecEvaluator,
@@ -26,7 +26,7 @@ class UadEvaluator(BaseEvaluator):
26
26
  entities = MODELS
27
27
 
28
28
  def update_config(self):
29
- """update evalution config"""
29
+ """update evaluation config"""
30
30
  self.pdx_config.update_dataset(self.global_config.dataset_dir, "SegDataset")
31
31
  self.pdx_config.update_pretrained_weights(None, is_backbone=True)
32
32
 
@@ -47,7 +47,7 @@ class UadEvaluator(BaseEvaluator):
47
47
  return config_path
48
48
 
49
49
  def get_eval_kwargs(self) -> dict:
50
- """get key-value arguments of model evalution function
50
+ """get key-value arguments of model evaluation function
51
51
 
52
52
  Returns:
53
53
  dict: the arguments of evaluation function.
@@ -13,6 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from .dataset_checker import BaseDatasetChecker, build_dataset_checker
16
- from .evaluator import BaseEvaluator, build_evaluater
16
+ from .evaluator import BaseEvaluator, build_evaluator
17
17
  from .exportor import BaseExportor, build_exportor
18
18
  from .trainer import BaseTrainer, build_trainer
@@ -27,14 +27,14 @@ from ...utils.misc import AutoRegisterABCMetaClass
27
27
  from .build_model import build_model
28
28
 
29
29
 
30
- def build_evaluater(config: AttrDict) -> "BaseEvaluator":
31
- """build model evaluater
30
+ def build_evaluator(config: AttrDict) -> "BaseEvaluator":
31
+ """build model evaluator
32
32
 
33
33
  Args:
34
34
  config (AttrDict): PaddleX pipeline config, which is loaded from pipeline yaml file.
35
35
 
36
36
  Returns:
37
- BaseEvaluator: the evaluater, which is subclass of BaseEvaluator.
37
+ BaseEvaluator: the evaluator, which is subclass of BaseEvaluator.
38
38
  """
39
39
  model_name = config.Global.model
40
40
  try:
@@ -161,10 +161,10 @@ evaling!"
161
161
 
162
162
  @abstractmethod
163
163
  def update_config(self):
164
- """update evalution config"""
164
+ """update evaluation config"""
165
165
  raise NotImplementedError
166
166
 
167
167
  @abstractmethod
168
168
  def get_eval_kwargs(self):
169
- """get key-value arguments of model evalution function"""
169
+ """get key-value arguments of model evaluation function"""
170
170
  raise NotImplementedError
@@ -21,7 +21,7 @@ from ...utils.device import (
21
21
  set_env_for_device,
22
22
  update_device_num,
23
23
  )
24
- from ...utils.flags import FLAGS_json_format_model, DISABLE_CINN_MODEL_WL
24
+ from ...utils.flags import DISABLE_CINN_MODEL_WL, FLAGS_json_format_model
25
25
  from ...utils.misc import AutoRegisterABCMetaClass
26
26
  from .build_model import build_model
27
27
  from .utils.cinn_setting import CINN_WHITELIST, enable_cinn_backend
@@ -18,12 +18,12 @@ from .model_list import MODELS
18
18
 
19
19
 
20
20
  class DocVLMDatasetChecker(BaseDatasetChecker):
21
- """Dataset Checker for Document Vision Languange Model"""
21
+ """Dataset Checker for Document Vision Language Model"""
22
22
 
23
23
  entities = MODELS
24
24
 
25
25
  def __init__(self, config):
26
26
  # not support for now
27
27
  raise UnsupportedAPIError(
28
- "document vision languange models do not support data check for now."
28
+ "document vision language models do not support data check for now."
29
29
  )
@@ -18,12 +18,12 @@ from .model_list import MODELS
18
18
 
19
19
 
20
20
  class DocVLMEvaluator(BaseEvaluator):
21
- """Document Vision Languange Model Evaluator"""
21
+ """Document Vision Language Model Evaluator"""
22
22
 
23
23
  entities = MODELS
24
24
 
25
25
  def __init__(self, config):
26
26
  # not support for now
27
27
  raise UnsupportedAPIError(
28
- "document vision languange models do not support evaluate for now."
28
+ "document vision language models do not support evaluate for now."
29
29
  )
@@ -18,12 +18,12 @@ from .model_list import MODELS
18
18
 
19
19
 
20
20
  class DocVLMExportor(BaseExportor):
21
- """Document Vision Languange Model Exportor"""
21
+ """Document Vision Language Model Exportor"""
22
22
 
23
23
  entities = MODELS
24
24
 
25
25
  def __init__(self, config):
26
26
  # not support for now
27
27
  raise UnsupportedAPIError(
28
- "document vision languange models do not support export for now."
28
+ "document vision language models do not support export for now."
29
29
  )
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- MODELS = ["PP-DocBee-2B", "PP-DocBee-7B"]
16
+ MODELS = ["PP-DocBee-2B", "PP-DocBee-7B", "PP-Chart2Table", "PP-DocBee2-3B"]
@@ -18,14 +18,14 @@ from .model_list import MODELS
18
18
 
19
19
 
20
20
  class DocVLMTrainer(BaseTrainer):
21
- """Document Vision Languange Model Trainer"""
21
+ """Document Vision Language Model Trainer"""
22
22
 
23
23
  entities = MODELS
24
24
 
25
25
  def __init__(self, config):
26
26
  # not support for now
27
27
  raise UnsupportedAPIError(
28
- "Document vision languange models do not support train for now."
28
+ "Document vision language models do not support train for now."
29
29
  )
30
30
 
31
31
  def update_config(self):