Skip to content

Commit 7f45ff5

Browse files
committed
Fix bugs (#4616)
* Rename files and classes * Fix doc * Fix bug
1 parent beefe5c commit 7f45ff5

File tree

25 files changed

+53
-56
lines changed

25 files changed

+53
-56
lines changed

docs/pipeline_usage/tutorials/ocr_pipelines/PaddleOCR-VL.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,15 +878,11 @@ for res in output:
878878

879879
#### 3.1.1 使用 Docker 镜像
880880

881-
PaddleX 针对不同推理加速框架提供了相应的 Docker 镜像,用于快速启动 VLM 推理服务:
882-
883-
* **vLLM**`ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddlex-genai-vllm-server`
884-
* **SGLang**`ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddlex-genai-sglang-server`
885-
886-
以 vLLM 为例,可使用以下命令启动服务:
881+
PaddleX 提供了 Docker 镜像,用于快速启动 vLLM 推理服务。可使用以下命令启动服务:
887882

888883
```bash
889884
docker run \
885+
-it \
890886
--rm \
891887
--gpus all \
892888
--network host \
@@ -899,6 +895,7 @@ docker run \
899895

900896
```bash
901897
docker run \
898+
-it \
902899
--rm \
903900
--gpus all \
904901
--network host \

paddlex/inference/models/doc_vlm/modeling/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# limitations under the License.
1414

1515
from .GOT_ocr_2_0 import PPChart2TableInference
16-
from .ppocrvl import PPOCRVLForConditionalGeneration
16+
from .paddleocr_vl import PaddleOCRVLForConditionalGeneration
1717
from .qwen2_5_vl import PPDocBee2Inference
1818
from .qwen2_vl import PPDocBeeInference, Qwen2VLForConditionalGeneration

paddlex/inference/models/doc_vlm/modeling/ppocrvl/__init__.py renamed to paddlex/inference/models/doc_vlm/modeling/paddleocr_vl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from ._ppocrvl import PPOCRVLForConditionalGeneration
15+
from ._paddleocr_vl import PaddleOCRVLForConditionalGeneration

paddlex/inference/models/doc_vlm/modeling/ppocrvl/_config.py renamed to paddlex/inference/models/doc_vlm/modeling/paddleocr_vl/_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
class PPOCRVisionConfig(PretrainedConfig):
33-
model_type = "ppocrvl"
33+
model_type = "paddleocr_vl"
3434
base_config_key = "vision_config"
3535

3636
def __init__(
@@ -67,8 +67,8 @@ def __init__(
6767
self.tokens_per_second = tokens_per_second
6868

6969

70-
class PPOCRVLConfig(PretrainedConfig):
71-
model_type = "ppocrvl"
70+
class PaddleOCRVLConfig(PretrainedConfig):
71+
model_type = "paddleocr_vl"
7272
keys_to_ignore_at_inference = ["past_key_values"]
7373
sub_configs = {"vision_config": PPOCRVisionConfig}
7474

paddlex/inference/models/doc_vlm/modeling/ppocrvl/_ernie.py renamed to paddlex/inference/models/doc_vlm/modeling/paddleocr_vl/_ernie.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from ....common.vlm.transformers.model_outputs import (
4444
BaseModelOutputWithPastAndCrossAttentions,
4545
)
46-
from ._config import PPOCRVLConfig
46+
from ._config import PaddleOCRVLConfig
4747
from ._distributed import (
4848
AllGatherVarlenOp,
4949
ColumnParallelLinear,
@@ -76,7 +76,7 @@ def calc_lm_head_logits(
7676
handling sequence parallelism and tensor parallelism configurations.
7777
7878
Args:
79-
config (PPOCRVLConfig): Model configuration.
79+
config (PaddleOCRVLConfig): Model configuration.
8080
hidden_states (Tensor): Hidden states from the transformer layers
8181
weight (Tensor): Weight matrix for the language model head
8282
bias (Tensor): Bias vector for the language model head
@@ -263,7 +263,7 @@ def __init__(self, config):
263263
Initialize RMSNorm layer.
264264
265265
Args:
266-
config (PPOCRVLConfig): Model configuration.
266+
config (PaddleOCRVLConfig): Model configuration.
267267
"""
268268
super().__init__()
269269
self.hidden_size = config.hidden_size
@@ -324,7 +324,7 @@ def __init__(self, config):
324324
Initialize LayerNorm with configuration.
325325
326326
Args:
327-
config (PPOCRVLConfig): Model configuration contains normalization parameters and flags.
327+
config (PaddleOCRVLConfig): Model configuration contains normalization parameters and flags.
328328
"""
329329
super().__init__(config.hidden_size, epsilon=config.rms_norm_eps)
330330
self.config = config
@@ -334,7 +334,7 @@ def __init__(self, config):
334334

335335

336336
class KeyeRotaryEmbedding(nn.Layer):
337-
def __init__(self, config: PPOCRVLConfig, device=None):
337+
def __init__(self, config: PaddleOCRVLConfig, device=None):
338338
super().__init__()
339339
self.rope_kwargs = {}
340340
if config is None:
@@ -408,7 +408,7 @@ def __init__(self, config, layer_idx=0):
408408
Initialize the MLP module with configuration options.
409409
410410
Args:
411-
config (PPOCRVLConfig): Model configurations.
411+
config (PaddleOCRVLConfig): Model configurations.
412412
layer_idx (int): Index of current layer (default: 0)
413413
"""
414414
super().__init__()
@@ -507,7 +507,7 @@ def __init__(self, config, layer_idx=0):
507507
"""Initialize the attention layer.
508508
509509
Args:
510-
config (PPOCRVLConfig): Model configuration.
510+
config (PaddleOCRVLConfig): Model configuration.
511511
layer_idx (int, optional): Index in transformer stack. Defaults to 0.
512512
"""
513513
super().__init__()
@@ -1223,7 +1223,7 @@ def __init__(self, config, return_tuple=True):
12231223
"""Initialize the pretraining criterion.
12241224
12251225
Args:
1226-
config (PPOCRVLConfig): Model configuration.
1226+
config (PaddleOCRVLConfig): Model configuration.
12271227
return_tuple (bool): Whether to return loss as tuple (loss, loss_sum). Defaults to True.
12281228
"""
12291229
super(ErniePretrainingCriterion, self).__init__()
@@ -1516,7 +1516,7 @@ def __init__(self, config):
15161516
"""Initialize the language model head.
15171517
15181518
Args:
1519-
config (PPOCRVLConfig): Model configuration containing:
1519+
config (PaddleOCRVLConfig): Model configuration containing:
15201520
- vocab_size: Size of vocabulary
15211521
- hidden_size: Dimension of hidden states
15221522
- tensor_parallel_degree: Degree of tensor parallelism
@@ -1632,7 +1632,7 @@ def __init__(self, config, layer_idx):
16321632
"""Initialize the decoder layer.
16331633
16341634
Args:
1635-
config (PPOCRVLConfig): Model configuration.
1635+
config (PaddleOCRVLConfig): Model configuration.
16361636
layer_idx (int): Index of this layer in the transformer stack
16371637
"""
16381638
super().__init__()
@@ -1776,15 +1776,15 @@ def model_parallel_dropout(self):
17761776
class Ernie4_5PretrainedModel(PretrainedModel):
17771777
"""Base class for ERNIE pretrained models."""
17781778

1779-
config_class = PPOCRVLConfig
1779+
config_class = PaddleOCRVLConfig
17801780
base_model_prefix = "ernie"
17811781

17821782
@classmethod
17831783
def _get_tensor_parallel_mappings(cls, config, is_split=True):
17841784
"""Generate tensor parallel mappings for model conversion.
17851785
17861786
Args:
1787-
config (PPOCRVLConfig): Model configuration.
1787+
config (PaddleOCRVLConfig): Model configuration.
17881788
is_split (bool): Whether to generate split mappings (True)
17891789
or merge mappings (False). Defaults to True.
17901790
@@ -2005,11 +2005,11 @@ def get_tensor_parallel_split_mappings(num_hidden_layers):
20052005
class Ernie4_5Model(Ernie4_5PretrainedModel):
20062006
"""The core ERNIE transformer model"""
20072007

2008-
def __init__(self, config: PPOCRVLConfig):
2008+
def __init__(self, config: PaddleOCRVLConfig):
20092009
"""Initialize the ERNIE model architecture.
20102010
20112011
Args:
2012-
config (PPOCRVLConfig): Model configuration.
2012+
config (PaddleOCRVLConfig): Model configuration.
20132013
"""
20142014
super().__init__(config)
20152015
self.padding_idx = config.pad_token_id

0 commit comments

Comments
 (0)