如何修复此错误没有名为“llama_index.llms.llama_cpp”的模块

问题描述 投票:0回答:1

我尝试将 mixtral-8x7b 与我自己的数据一起使用,但没有成功。这是我的代码

import torch
from llama_index.llms.llama_cpp import LlamaCPP
from llama_index.llms.llama_cpp.llama_utils import messages_to_prompt, completion_to_prompt
llm = LlamaCPP(
    model_url=None, # We'll load locally.
    model_path='./Models/mixtral-8x7b-instruct-v0.1.Q4_K_M.gguf', # 4-bit model
    temperature=0.1,
    max_new_tokens=1024, # Increasing to support longer responses
    context_window=8192, # Mistral7B has an 8K context-window
    generate_kwargs={},
    # set to at least 1 to use GPU
    model_kwargs={"n_gpu_layers": 40}, # 40 was a good amount of layers for the RTX 3090, you may need to decrease yours if you have less VRAM than 24GB
    messages_to_prompt=messages_to_prompt,
    completion_to_prompt=completion_to_prompt,
    verbose=True
)

这给出了错误“没有名为“llama_index.llms.llama_cpp”的模块”。

我已经安装了 llama_index,使用了我的 MAC Mini 以及 Google Colab 的 GPU

有什么建议吗?

machine-learning nlp
1个回答
0
投票

我认为除了

llama-index-llms-llama-cpp
之外,您还需要按照
安装指南
的建议使用以下命令安装
llama-index-embeddings-huggingface
llama-index

pip install llama-index-llms-llama-cpp llama-index-embeddings-huggingface
© www.soinside.com 2019 - 2024. All rights reserved.