We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a12c9f commit 1f0b9a2Copy full SHA for 1f0b9a2
llama_cpp/llama.py
@@ -2083,11 +2083,14 @@ def pooling_type(self) -> str:
2083
2084
def close(self) -> None:
2085
"""Explicitly free the model from memory."""
2086
- self._stack.close()
+ if hasattr(self,'_stack'):
2087
+ if self._stack is not None:
2088
+ self._stack.close()
2089
2090
def __del__(self) -> None:
- if self._lora_adapter is not None:
- llama_cpp.llama_lora_adapter_free(self._lora_adapter)
2091
+ if hasattr(self,'_lora_adapter'):
2092
+ if self._lora_adapter is not None:
2093
+ llama_cpp.llama_lora_adapter_free(self._lora_adapter)
2094
self.close()
2095
2096
@staticmethod
0 commit comments