fix: Check for existence of clip model path (#1264)

This commit is contained in:
Kevin Cao 2024-03-08 21:00:10 -05:00 committed by GitHub
parent 2811014bae
commit 1f3156d4f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1848,6 +1848,9 @@ class Llava15ChatHandler:
self.verbose = verbose
self._clip_free = self._llava_cpp._libllava.clip_free # type: ignore
if not os.path.exists(clip_model_path):
raise ValueError(f"Clip model path does not exist: {clip_model_path}")
with suppress_stdout_stderr(disable=self.verbose):
self.clip_ctx = self._llava_cpp.clip_model_load(
self.clip_model_path.encode(), 0