8000 fix: destructor exception where internal classes are missing some uni… · bellofils/llama-cpp-python@6943bab · GitHub
[go: up one dir, main page]

Skip to content

Commit 6943bab

Browse files
committed
fix: destructor exception where internal classes are missing some uninitialized attributes
1 parent 07a7837 commit 6943bab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llama_cpp/_internals.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def __init__(
4242

4343
self._llama_free_model = llama_cpp._lib.llama_free_model # type: ignore
4444

45+
self.model = None
46+
4547
if not os.path.exists(path_model):
4648
raise ValueError(f"Model path does not exist: {path_model}")
4749

@@ -248,6 +250,7 @@ def __init__(
248250
self.verbose = verbose
249251

250252
self._llama_free = llama_cpp._lib.llama_free # type: ignore
253+
self.ctx = None
251254

252255
assert self.model.model is not None
253256

@@ -497,6 +500,7 @@ def __init__(
497500

498501
self._llama_batch_free = llama_cpp._lib.llama_batch_free # type: ignore
499502

503+
self.batch = None
500504
self.batch = llama_cpp.llama_batch_init(
501505
self.n_tokens, self.embd, self.n_seq_max
502506
)

0 commit comments

Comments
 (0)
0