Skip to content

Commit 5955254

Browse files
committed
bugfix: fix PaddleOCR-VL downloading from AIStudio
1 parent 677ea06 commit 5955254

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

paddlex/inference/utils/official_models.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ def get_model(self, model_name):
432432
f"Using official model ({model_name}), the model files will be automatically downloaded and saved in `{model_dir}`."
433433
)
434434
self._download(model_name, model_dir)
435+
logging.debug(
436+
f"`{model_name}` model files has been download from model source: `{self.alias}`!"
437+
)
435438

436439
if model_name == "PaddleOCR-VL":
437440
vl_model_dir = model_dir / "PaddleOCR-VL-0.9B"
@@ -531,7 +534,12 @@ class _AIStudioModelHoster(_BaseModelHoster):
531534

532535
def _download(self, model_name, save_dir):
533536
def _clone(local_dir):
534-
aistudio_download(repo_id=f"PaddleX/{model_name}", local_dir=local_dir)
537+
if model_name == "PaddleOCR-VL":
538+
aistudio_download(
539+
repo_id=f"PaddlePaddle/{model_name}", local_dir=local_dir
540+
)
541+
else:
542+
aistudio_download(repo_id=f"PaddleX/{model_name}", local_dir=local_dir)
535543

536544
if os.path.exists(save_dir):
537545
_clone(save_dir)
@@ -586,9 +594,6 @@ def _download_from_hoster(self, hosters, model_name):
586594
if model_name in hoster.model_list:
587595
try:
588596
model_path = hoster.get_model(model_name)
589-
logging.debug(
590-
f"`{model_name}` model files has been download from model source: `{hoster.alias}`!"
591-
)
592597
return model_path
593598

594599
except Exception as e:
@@ -597,7 +602,7 @@ def _download_from_hoster(self, hosters, model_name):
597602
f"Encounter exception when download model from {hoster.alias}. No model source is available! Please check network or use local model files!"
598603
)
599604
logging.warning(
600-
f"Encountering exception when download model from {hoster.alias}: \n{e}, will try to download from other model sources: `hosters[idx + 1].alias`."
605+
f"Encountering exception when download model from {hoster.alias}: \n{e}, will try to download from other model sources: `{hosters[idx + 1].alias}`."
601606
)
602607
return self._download_from_hoster(hosters[idx + 1 :], model_name)
603608

0 commit comments

Comments
 (0)