Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llama_cpp/_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def free_model():
self._exit_stack.callback(free_model)

def close(self):
if self.sampler is not None:
if hasattr(self, "sampler") and self.sampler is not None:
# NOTE: Must remove custom samplers before free or llama.cpp will try to free them
for i, _ in reversed(self.custom_samplers):
llama_cpp.llama_sampler_chain_remove(self.sampler, i)
Expand Down