René's URL Explorer Experiment


Title: Running basic example from docs results in `TypeError: 'NoneType' object is not callable` · Issue #1998 · abetlen/llama-cpp-python · GitHub

Open Graph Title: Running basic example from docs results in `TypeError: 'NoneType' object is not callable` · Issue #1998 · abetlen/llama-cpp-python

X Title: Running basic example from docs results in `TypeError: 'NoneType' object is not callable` · Issue #1998 · abetlen/llama-cpp-python

Description: Prerequisites Please answer the following questions for yourself before submitting an issue. I am running the latest code. Development is very rapid so there are no tagged versions as of now. I carefully followed the README.md. I searche...

Open Graph Description: Prerequisites Please answer the following questions for yourself before submitting an issue. I am running the latest code. Development is very rapid so there are no tagged versions as of now. I car...

X Description: Prerequisites Please answer the following questions for yourself before submitting an issue. I am running the latest code. Development is very rapid so there are no tagged versions as of now. I car...

Opengraph URL: https://github.com/abetlen/llama-cpp-python/issues/1998

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Running basic example from docs results in `TypeError: 'NoneType' object is not callable`","articleBody":"# Prerequisites\n\nPlease answer the following questions for yourself before submitting an issue.\n\n- [x] I am running the latest code. Development is very rapid so there are no tagged versions as of now.\n- [x] I carefully followed the [README.md](https://github.com/abetlen/llama-cpp-python/blob/main/README.md).\n- [x] I [searched using keywords relevant to my issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests) to make sure that I am creating a new issue that is not already open (or closed).\n- [x] I reviewed the [Discussions](https://github.com/abetlen/llama-cpp-python/discussions), and have a new bug or useful enhancement to share.\n\n# Expected Behavior\n\nI am trying to run the most basic examples [from the docs][1].\n\nI am trying to load a model that I've downloaded:\n\n```python\nfrom llama_cpp import Llama\n\n\nif __name__ == \"__main__\":\n    llm = Llama(\n        model_path=\"models/qwen2-0_5b-instruct-q4_0.gguf\",\n        verbose=False,\n    )\n    output = llm(\n        \"Q: Name the planets in the solar system? A: \",\n        max_tokens=32,\n        stop=[\"Q:\", \"\\n\"],\n        echo=True,\n    )\n    print(output)\n```\n\nAnd I am also trying to load a model directly from Hugging Face hub:\n\n```python\nfrom llama_cpp import Llama\n\n\nif __name__ == \"__main__\":\n    llm = Llama.from_pretrained(\n        repo_id=\"Qwen/Qwen2-0.5B-Instruct-GGUF\",\n        filename=\"*q4_0.gguf\",\n        verbose=False,\n    )\n```\n\nI expect these basic examples to run without error and produce some reasonable looking output.\n\n[1]: https://llama-cpp-python.readthedocs.io/en/latest/#high-level-api\n\n# Current Behavior\n\nIn both cases -- whether using a pre-downloaded model or pulling from Hugging Face Hub -- I am getting the following exception:\n\n```python\nException ignored in: \u003cfunction Llama.__del__ at 0x14b2e5940>\nTraceback (most recent call last):\n  File \".../.venv/lib/python3.11/site-packages/llama_cpp/llama.py\", line 2205, in __del__\n  File \".../.venv/lib/python3.11/site-packages/llama_cpp/llama.py\", line 2202, in close\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 609, in close\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 601, in __exit__\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 586, in __exit__\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 360, in __exit__\n  File \".../.venv/lib/python3.11/site-packages/llama_cpp/_internals.py\", line 75, in close\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 609, in close\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 601, in __exit__\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 586, in __exit__\n  File \".../.pyenv/versions/3.11.11/lib/python3.11/contextlib.py\", line 469, in _exit_wrapper\n  File \".../.venv/lib/python3.11/site-packages/llama_cpp/_internals.py\", line 69, in free_model\nTypeError: 'NoneType' object is not callable\n```\n\nThis appears to be the line raising this exception:\n\nhttps://github.com/abetlen/llama-cpp-python/blob/99f2ebfde18912adeb7f714b49c1ddb624df3087/llama_cpp/_internals.py#L69\n\nIn the case of using the pre-downloaded model, I see the printed model output first before I get the exception. In the case of pulling from Hugging Face Hub, I get the exception immediately.\n\n# Environment and Context\n\n- macOS 15.4 running on M3 Apple Silicon\n- Python 3.11.11\n- GNU Make 3.81\n- llama-cpp-python @ 99f2ebf (the latest from `main` as of 2025-04-11)\n\n# Steps to Reproduce\n\n1. Copy either test script from above into `test-llama.py`.\n2. Run `python test-llama.py`\n\nThis seems to be an issue specific to the Python bindings, so I did not trying building `llama.cpp`.\n\nThis issue is possibly related to #1442.","author":{"url":"https://github.com/nchammas","@type":"Person","name":"nchammas"},"datePublished":"2025-04-11T14:45:21Z","url":"https://github.com/abetlen/llama-cpp-python/issues/1998"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8ec8525a-7acb-8fe3-2960-97cadcf05e57
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA832:30DBED:10D3EF1:151634C:6AFF89AF
html-safe-noncea39b783ef9808821d167cb490683ef4a8bd83b26b850bdef2a6dd2c8c7ed243b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODMyOjMwREJFRDoxMEQzRUYxOjE1MTYzNEM6NkFGRjg5QUYiLCJ2aXNpdG9yX2lkIjoiNTc4MzEzNzQ2MTE0ODI4OTQ1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacea492df19825455457d1652380a078d573d293894fc38e13be7f478a2759e14f
hovercard-subject-tagissue:2988878509
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/abetlen/llama-cpp-python/1998/issue_layout
twitter:imagehttps://opengraph.githubassets.com/abe965b17bfee43b6388cd76dff48403db51209d2e64f82a4a67270b7225774e/abetlen/llama-cpp-python/issues/1998
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/abe965b17bfee43b6388cd76dff48403db51209d2e64f82a4a67270b7225774e/abetlen/llama-cpp-python/issues/1998
og:image:altPrerequisites Please answer the following questions for yourself before submitting an issue. I am running the latest code. Development is very rapid so there are no tagged versions as of now. I car...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenchammas
hostnamegithub.com
expected-hostnamegithub.com
None587ad99a3e443b2e1cb0d3df059ec49ab54389861f13310766dfdeb615fed90d
turbo-cache-controlno-preview
go-importgithub.com/abetlen/llama-cpp-python git https://github.com/abetlen/llama-cpp-python.git
octolytics-dimension-user_id6826477
octolytics-dimension-user_loginabetlen
octolytics-dimension-repository_id617868717
octolytics-dimension-repository_nwoabetlen/llama-cpp-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id617868717
octolytics-dimension-repository_network_root_nwoabetlen/llama-cpp-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5bb0fb68d64881d1344f5863d809515d496801e5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/abetlen/llama-cpp-python/issues/1998#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fabetlen%2Fllama-cpp-python%2Fissues%2F1998
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fabetlen%2Fllama-cpp-python%2Fissues%2F1998
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=abetlen%2Fllama-cpp-python
Reloadhttps://github.com/abetlen/llama-cpp-python/issues/1998
Reloadhttps://github.com/abetlen/llama-cpp-python/issues/1998
Reloadhttps://github.com/abetlen/llama-cpp-python/issues/1998
abetlenhttps://github.com/abetlen
llama-cpp-pythonhttps://github.com/abetlen/llama-cpp-python
Codehttps://github.com/abetlen/llama-cpp-python
Issues600 (600)https://github.com/abetlen/llama-cpp-python/issues
Pull requests122 (122)https://github.com/abetlen/llama-cpp-python/pulls
Discussionshttps://github.com/abetlen/llama-cpp-python/discussions
Actionshttps://github.com/abetlen/llama-cpp-python/actions
Projectshttps://github.com/abetlen/llama-cpp-python/projects
Security and quality1 (1)https://github.com/abetlen/llama-cpp-python/security
Insightshttps://github.com/abetlen/llama-cpp-python/pulse
https://github.com/abetlen/llama-cpp-python
New issuehttps://github.com/login?return_to=https://github.com/abetlen/llama-cpp-python/issues/1998
New issuehttps://github.com/login?return_to=https://github.com/abetlen/llama-cpp-python/issues/1998
#2397https://github.com/abetlen/llama-cpp-python/pull/2397
Running basic example from docs results in TypeError: 'NoneType' object is not callablehttps://github.com/abetlen/llama-cpp-python/issues/1998#top
#2397https://github.com/abetlen/llama-cpp-python/pull/2397
https://github.com/nchammas
nchammashttps://github.com/nchammas
on Apr 11, 2025https://github.com/abetlen/llama-cpp-python/issues/1998#issue-2988878509
README.mdhttps://github.com/abetlen/llama-cpp-python/blob/main/README.md
searched using keywords relevant to my issuehttps://docs.github.com/en/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests
Discussionshttps://github.com/abetlen/llama-cpp-python/discussions
from the docshttps://llama-cpp-python.readthedocs.io/en/latest/#high-level-api
llama-cpp-python/llama_cpp/_internals.pyhttps://github.com/abetlen/llama-cpp-python/blob/99f2ebfde18912adeb7f714b49c1ddb624df3087/llama_cpp/_internals.py#L69
99f2ebfhttps://github.com/abetlen/llama-cpp-python/commit/99f2ebfde18912adeb7f714b49c1ddb624df3087
99f2ebfhttps://github.com/abetlen/llama-cpp-python/commit/99f2ebfde18912adeb7f714b49c1ddb624df3087
#1442https://github.com/abetlen/llama-cpp-python/issues/1442
https://github.com/quanfeifan
quanfeifanhttps://github.com/quanfeifan
on May 19, 2025https://github.com/abetlen/llama-cpp-python/issues/1998#issuecomment-2889852505
Sign up for freehttps://github.com/signup?return_to=https://github.com/abetlen/llama-cpp-python/issues/1998
Sign in to commenthttps://github.com/login?return_to=https://github.com/abetlen/llama-cpp-python/issues/1998
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.