Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5e059c

Browse filesBrowse files
committed
Free model when llama is unloaded. Closes abetlen#434
1 parent 442213b commit a5e059c
Copy full SHA for a5e059c

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎llama_cpp/llama.py

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,9 @@ def create_chat_completion(
14371437
return self._convert_text_completion_to_chat(completion)
14381438

14391439
def __del__(self):
1440+
if self.model is not None:
1441+
llama_cpp.llama_free_model(self.model)
1442+
self.model = None
14401443
if self.ctx is not None:
14411444
llama_cpp.llama_free(self.ctx)
14421445
self.ctx = None

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.