8000 llama: fix exception in Llama.__del__ by cebtenzzre · Pull Request #846 · abetlen/llama-cpp-python · GitHub
[go: up one dir, main page]

Skip to content

llama: fix exception in Llama.__del__ #846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

cebtenzzre
Copy link
Contributor

This fixes an exception that I consistently see with oobabooga's TGWUI:

Traceback (most recent call last):
  File "/home/cebtenzzre/src/forks/text-generation-webui/modules/llamacpp_model.py", line 42, in __del__
  File "/home/cebtenzzre/src/forks/llama-cpp-python/llama_cpp/llama.py", line 1720, in __del__
  File "/home/cebtenzzre/src/forks/llama-cpp-python/llama_cpp/llama.py", line 1712, in _free_model
TypeError: 'NoneType' object is not callable
Exception ignored in: <function Llama.__del__ at 0x7f55471987c0>
Traceback (most recent call last):
  File "/home/cebtenzzre/src/forks/llama-cpp-python/llama_cpp/llama.py", line 1720, in __del__
  File "/home/cebtenzzre/src/forks/llama-cpp-python/llama_cpp/llama.py", line 1712, in _free_model
TypeError: 'NoneType' object is not callable

__del__ can be tricky to implement because there are few guarantees about what has not already been destroyed. This fix uses a similar approach to what the python stdlib does in deleters.

@abetlen abetlen merged commit eefd76f into abetlen:main Nov 1, 2023
@abetlen
Copy link
Owner
abetlen commented Nov 1, 2023

@cebtenzzre thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0