Skip to content

Commit 9a1154e

Browse files
authored
[Fix] Fix PaddleOCR-VL dtype error on DCU and typos in document (#4692)
* Fix bugs * Fix docs * Fix typo * Fix bug
1 parent 07c5db6 commit 9a1154e

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ The default save path for the configuration file is `PaddleOCR-VL.yaml`. Modify
997997
VLRecognition:
998998
...
999999
genai_config:
1000-
backend: vllm
1001-
server_url: http://127.0.0.1:8118
1000+
backend: vllm-server
1001+
server_url: http://127.0.0.1:8118/v1
10021002
```
10031003
10041004
After that, the modified configuration file can be used for production line invocation. For example, invoke it through the CLI:
@@ -1290,7 +1290,7 @@ Below are the API references for basic service-based deployment and examples of
12901290
</tr>
12911291
<tr>
12921292
<td><code>promptLabel</code></td>
1293-
<td><code>string</code>|<code>object</code>|<code>null</code></td>
1293+
<td><code>string</code>|<code>null</code></td>
12941294
<td>Please refer to the description of the <code>prompt_label</code> parameter in the <code>predict</code> method of the PaddleOCR-VL object.</td>
12951295
<td>No</td>
12961296
</tr>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,8 @@ paddlex --get_pipeline_config PaddleOCR-VL
10381038
VLRecognition:
10391039
...
10401040
genai_config:
1041-
backend: vllm
1042-
server_url: http://127.0.0.1:8118
1041+
backend: vllm-server
1042+
server_url: http://127.0.0.1:8118/v1
10431043
```
10441044
10451045
之后,可以使用修改好的配置文件进行产线调用。例如通过 CLI 调用:
@@ -1334,7 +1334,7 @@ INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
13341334
</tr>
13351335
<tr>
13361336
<td><code>promptLabel</code></td>
1337-
<td><code>string</code> | <code>object</code> | <code>null</code></td>
1337+
<td><code>string</code> | <code>null</code></td>
13381338
<td>请参阅PaddleOCR-VL对象中 <code>predict</code> 方法的 <code>prompt_label</code> 参数相关说明。</td>
13391339
<td>否</td>
13401340
</tr>

paddlex/inference/models/base/predictor/base_predictor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from ....utils.benchmark import ENTRY_POINT_NAME, benchmark
3636
from ....utils.hpi import HPIConfig, HPIInfo
3737
from ....utils.io import YAMLReader
38-
from ....utils.model_paths import get_model_paths
3938
from ....utils.pp_option import PaddlePredictorOption
4039
from ...common import HPInfer, PaddleInfer
4140
from ...common.genai import GenAIClient, GenAIConfig, need_local_model
@@ -156,7 +155,7 @@ def __init__(
156155

157156
self.batch_sampler.batch_size = batch_size
158157

159-
if self.model_dir and get_model_paths(self.model_dir, self.MODEL_FILE_PREFIX):
158+
if self._use_local_model:
160159
self._use_hpip = use_hpip
161160
if not use_hpip:
162161
self._pp_option = self._prepare_pp_option(pp_option, device)

paddlex/inference/models/common/genai.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def stop(self):
8888
self.loop = None
8989
self.thread = None
9090

91-
def run_async(self, coro, return_future=False):
91+
def run_async(self, coro):
9292
if not self.is_running():
9393
raise RuntimeError("Event loop is not running")
9494

@@ -164,6 +164,8 @@ def __init__(
164164

165165
self.backend = backend
166166
self._max_concurrency = max_concurrency
167+
if model_name is None:
168+
model_name = run_async(self._get_model_name(), timeout=10)
167169
self._model_name = model_name
168170

169171
if "api_key" not in kwargs:
@@ -177,12 +179,6 @@ def openai_client(self):
177179
return self._client
178180

179181
def create_chat_completion(self, messages, *, return_future=False, **kwargs):
180-
if self._model_name is not None:
181-
model_name = self._model_name
182-
else:
183-
model_name = run_async(self._get_model_name(), timeout=10)
184-
self._model_name = model_name
185-
186182
async def _create_chat_completion_with_semaphore(*args, **kwargs):
187183
async with self._semaphore:
188184
return await self._client.chat.completions.create(
@@ -192,7 +188,7 @@ async def _create_chat_completion_with_semaphore(*args, **kwargs):
192188

193189
return run_async(
194190
_create_chat_completion_with_semaphore(
195-
model=model_name,
191+
model=self._model_name,
196192
messages=messages,
197193
**kwargs,
198194
),

paddlex/inference/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ def is_bfloat16_available(device):
3131
device_type, _ = parse_device(device)
3232
return (
3333
"npu" in get_device_type() or paddle.amp.is_bfloat16_supported()
34-
) and device_type in ("gpu", "npu", "xpu", "mlu", "dcu")
34+
) and device_type in ("gpu", "npu", "xpu", "mlu")

0 commit comments

Comments
 (0)