Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

llama_cpp conflict with transformers library #891

Copy link
Copy link
Closed
@speggioale

Description

@speggioale
Issue body actions

Hi everyone,

I'm currently trying to run the example script provided in the readme, but I noticed a Type error exception is thrown (and ignored) when importing the transformers==4.35.0 library in the same file.

Expected Behavior

The code snippet in the next section should generate an output without throwing any error.

Current Behavior

By running the following code snipped, I get an exception after the output is correctly generated. I'm aware the error is ignored but I would like to understand whether that's the expected behaviour or if there is something else I'm missing. Moreover, notice that removing import transformers produces the correct output.

import transformers
from llama_cpp import Llama

if __name__ == "__main__":

    llm = Llama(model_path="./models/7B/llama-model.gguf")
    output = llm("Q: Name the planets in the solar system? A: ",
                 max_tokens=32, stop=["Q:", "\n"], echo=True)

    print(output)

And I get the following error

Exception ignored in: <function _LlamaContext.__del__ at 0x7f4cfd08a3b0>
Traceback (most recent call last):
  File "/home/project/my_env/lib/python3.10/site-packages/llama_cpp/llama.py", line 418, in __del__
TypeError: 'NoneType' object is not callable
Exception ignored in: <function _LlamaModel.__del__ at 0x7f4cfd089480>
Traceback (most recent call last):
  File "/home/project/my_env/lib/python3.10/site-packages/llama_cpp/llama.py", line 238, in __del__
TypeError: 'NoneType' object is not callable
Exception ignored in: <function _LlamaBatch.__del__ at 0x7f4cfd08b7f0>
Traceback (most recent call last):
  File "/home/project/my_env/lib/python3.10/site-packages/llama_cpp/llama.py", line 664, in __del__
TypeError: 'NoneType' object is not callable

Environment and Context

  • x86_64 GNU/Linux
  • Python 3.10.9
  • GNU Make 4.2.1
  • g++ 9.4.0
kddubey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.