Skip to content

NameError: name 'open' is not defined when llama-cpp-python cleaning up. #860

Closed

Description

@fourdim

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 searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

No Exceptions.

Current Behavior

At the end of inference:

Exception ignored in: <function Llama.__del__ at 0x7f38d140f010>
Traceback (most recent call last):
  File "/home/ubuntu/.cache/pypoetry/virtualenvs/llm-gateway-NqZIJtg0-py3.10/lib/python3.10/site-packages/llama_cpp/llama.py", line 1655, in __del__
  File "/home/ubuntu/.cache/pypoetry/virtualenvs/llm-gateway-NqZIJtg0-py3.10/lib/python3.10/site-packages/llama_cpp/utils.py", line 8, in __enter__
NameError: name 'open' is not defined

Environment

Commit hash:

f0d1a1b

Related comments

#803 (comment)

Activity

  1. abetlen commented on Nov 2, 2023

    @abetlen
    Owner

    The issue was caused by some weird python behaviour inside of del methods. I'll include this in the next version which should be published sometime today.

  2. added a commit that references this issue on Jan 28, 2024
    011b95d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions