Module import doesn't work when using pip install llama-cpp-python --target="dir"
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 65/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- build-system
Piste de recherche
L’issue se trouve dans llama_cpp/llama.py aux lignes 26-27, où un import échoue lors de l’installation avec --target. Examinez la structure des modules pour comprendre le chemin d’importation correct. Testez la correction en installant le package avec --target dans un répertoire temporaire et en vérifiant que l’import fonctionne. Vérifiez s’il existe d’autres instructions d’importation similaires dans la base de code qui pourraient nécessiter la même modification.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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 <module>
llama_cpp = importlib.import_module(llama_module_dir, package="llama_cpp") # Import the llama module from the llama-cpp-python module
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", 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 <module>
from .llama import *
File "Z:\Anyboty_Client\PythonFiles\llama_cpp_versions\12_1\ggufv2\windows10\llama_cpp\llama.py", line 27, in <module>
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.
- Langage dominant
- Python
- Étoiles
- 10.6k
- Forks
- 1.5k
- Merge moyen
- 6 h 43 min
- PR mergées (30 j)
- 2
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de abetlen/llama-cpp-python
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
abetlen/llama-cpp-python#2371 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2352 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
abetlen/llama-cpp-python#2314 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2211 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
abetlen/llama-cpp-python#2210 ·
Toutes les issues de abetlen/llama-cpp-python
Issues similaires
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Ouvertearea: harness bug status: needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Human-Agent-Society/reef#625 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
learningequality/kolibri#15351 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Name consistency Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
eellak/triplestore#65 · 1 commentaire ·