abetlen / abetlen/llama-cpp-python

Module import doesn't work when using pip install llama-cpp-python --target="dir"

Đang mở
#907 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug build
Ngôn ngữ chính
Python
Star
10.6k
Fork
1.4k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

When using the latest update with how I've setup my embedded install, I ran into this issue:
```
No module named 'llama_cpp.llama_chat_format'
Traceback (most recent call last):
File "Z:\Anyboty_Client\llamacppClient.py", line 252, in
llama_cpp = importlib.import_module(llama_module_dir, package="llama_cpp") # Import the llama module from the llama-cpp-python module
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "Z:\Anyboty_Client\PythonFiles\llama_cpp_versions\12_1\ggufv2\windows10\llama_cpp\__init__.py", line 2, in
from .llama import *
File "Z:\Anyboty_Client\PythonFiles\llama_cpp_versions\12_1\ggufv2\windows10\llama_cpp\llama.py", line 27, in
import llama_cpp.llama_chat_format as llama_chat_format
ModuleNotFoundError: No module named 'llama_cpp.llama_chat_format'
```

I resolved the issue in my specific setup by changing this:
https://github.com/abetlen/llama-cpp-python/blob/01846a76b980224609ac8b69c8eb3f5785816752/llama_cpp/llama.py#L26-L27

To this:
```
from . import llama_cpp
from . import llama_chat_format
```

And while I think this is probably a fine solution, not 100% sure. So thought I'd just bring it to y'alls attention and let you fix it properly.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.