fix(ml): model downloading improvements (#3988)

* handle ort `NoSuchFile` error, stricter file check

* keep exception order
This commit is contained in:
Mert
2023-09-05 21:48:40 -04:00
committed by GitHub
parent 454737ca79
commit 3cf0f5f11b
2 changed files with 6 additions and 2 deletions

View File

@@ -131,6 +131,10 @@ class CLIPEncoder(InferenceModel):
os.remove(file)
return True
@property
def cached(self) -> bool:
return (self.cache_dir / "textual.onnx").is_file() and (self.cache_dir / "visual.onnx").is_file()
# same as `_transform_blob` without `_blob2image`
def _transform_pil_image(n_px: int) -> Compose: