8000 fix: annoying bug where attribute exceptions were droining out file n… · hackensun/llama-cpp-python@abc538f · GitHub
[go: up one dir, main page]

Skip to content

Commit abc538f

Browse files
committed
fix: annoying bug where attribute exceptions were droining out file not found exceptions
1 parent ffa8121 commit abc538f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llama_cpp/llama.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,10 +1503,10 @@ def create_chat_completion(
15031503
return self._convert_text_completion_to_chat(completion)
15041504

15051505
def __del__(self):
1506-
if self.model is not None:
1506+
if hasattr(self, "model") and self.model is not None:
15071507
llama_cpp.llama_free_model(self.model)
15081508
self.model = None
1509-
if self.ctx is not None:
1509+
if hasattr(self, "ctx") and self.ctx is not None:
15101510
llama_cpp.llama_free(self.ctx)
15111511
self.ctx = None
15121512

0 commit comments

Comments
 (0)
0