@@ -608,8 +608,9 @@ def from_pretrained(
608
608
)
609
609
610
610
if export is None :
611
- export = cls ._check_export_status (model_id , revision , subfolder , cache_dir , local_files_only or HF_HUB_OFFLINE )
612
-
611
+ export = cls ._check_export_status (
612
+ model_id , revision , subfolder , cache_dir , local_files_only or HF_HUB_OFFLINE
613
+ )
613
614
if not export and trust_remote_code :
614
615
logger .warning (
615
616
"The argument `trust_remote_code` is to be used along with export=True. It will be ignored."
@@ -642,15 +643,15 @@ def _check_export_status(
642
643
local_files_only : bool = HF_HUB_OFFLINE ,
643
644
):
644
645
model_dir = Path (model_id )
645
- if subfolder is not None :
646
+ if subfolder :
646
647
model_dir = model_dir / subfolder
647
648
if model_dir .is_dir ():
648
649
return (
649
650
not (model_dir / OV_XML_FILE_NAME ).exists ()
650
651
or not (model_dir / OV_XML_FILE_NAME .replace (".xml" , ".bin" )).exists ()
651
652
)
652
- normalized_subfolder = None if subfolder is None else Path (subfolder ).as_posix ()
653
- ov_model_path = OV_XML_FILE_NAME if subfolder is None else f"{ normalized_subfolder } /{ OV_XML_FILE_NAME } "
653
+ normalized_subfolder = None if not subfolder else Path (subfolder ).as_posix ()
654
+ ov_model_path = OV_XML_FILE_NAME if not subfolder else f"{ normalized_subfolder } /{ OV_XML_FILE_NAME } "
654
655
cache_model_path = try_to_load_from_cache (
655
656
model_id , ov_model_path , cache_dir = cache_dir , revision = revision or "main" , repo_type = "model"
656
657
)
@@ -672,7 +673,7 @@ def _check_export_status(
672
673
for file in model_info .siblings
673
674
if normalized_subfolder is None or file .rfilename .startswith (normalized_subfolder )
674
675
]
675
- ov_model_path = OV_XML_FILE_NAME if subfolder is None else f"{ normalized_subfolder } /{ OV_XML_FILE_NAME } "
676
+ ov_model_path = OV_XML_FILE_NAME if not subfolder else f"{ normalized_subfolder } /{ OV_XML_FILE_NAME } "
676
677
return ov_model_path not in model_files or ov_model_path .replace (".xml" , ".bin" ) not in model_files
677
678
except Exception :
678
679
return True
0 commit comments