abetlen / abetlen/llama-cpp-python

The new shared library causes conflicts if more than 1 variant of llama-cpp-python is imported

オープン
#1,575 コメント 10 件 リアクション 5 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
10.6k
フォーク
1.4k
PR マージ指標
PR 指標を取得中

説明

The `ctypes.CDLL` call under https://github.com/abetlen/llama-cpp-python/blob/7e20e346bd49cc8f0031eb053fe879a38c777b6f/llama_cpp/llama_cpp.py#L75 loads symbols in the global scope. In my project, it is possible to load 3 different versions of llama-cpp-python:

* CUDA
* CUDA + tensorcores (without `-DGGML_CUDA_FORCE_MMQ=ON`)
* CPU

Due to the shared library, when one of the libraries is already imported and the user switches to another one, undefined behavior happens, such as the CPU version having BLAS=1 in its logs.

Can this be prevented? I think that it may be impossible to work around this issue on my side. I have tried `importlib.reload` and it didn't work.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。