Skip to content

Conversation

kddubey
Copy link
Contributor

@kddubey kddubey commented Nov 28, 2023

Fix #891

As noted in the Python docs, objects can get nullified on interpreter shutdown in __del__. The solution follows the same pattern here

How has this been tested?

  1. Install a later version of transformers with torch:

    python -m pip install "transformers[torch]>=4.35.0"
    
  2. Checkout main

    git checkout main
    
  3. Verify that this command prints out the ignored Exception:

    python -c "import transformers; from llama_cpp import Llama; llm = Llama(model_path='./some.gguf', verbose=False)"
    
  4. Checkout this branch

    git checkout ignore-warnings-on-shutdown
    
  5. Verify that the same command does not print out the ignored Exception:

    python -c "import transformers; from llama_cpp import Llama; llm = Llama(model_path='./some.gguf', verbose=False)"
    

@kddubey
Copy link
Contributor Author

kddubey commented Nov 28, 2023

@abetlen if this looks good, apply the same changes to your (awesome!) PR here

@abetlen
Copy link
Owner

abetlen commented Nov 29, 2023

This is perfect, 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.

llama_cpp conflict with transformers library
2 participants