原始模型
回答存在严重幻觉
使用llama index构建RAG系统
必须在30%的服务器权限下才可以正常执行,否则显存会爆
代码
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.huggingface import HuggingFaceLLM
embed_model = HuggingFaceEmbedding(
model_name="/root/sentence-transformer"
)
Settings.embed_model = embed_model
llm = HuggingFaceLLM(
model_name="/root/internlm2-chat-1_8b",
tokenizer_name="/root/internlm2-chat-1_8b",
model_kwargs={"trust_remote_code":True},
tokenizer_kwargs={"trust_remote_code":True}
)
Settings.llm = llm
documents = SimpleDirectoryReader("/root/demo/data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("在clickhouse中,alter命令支持什么表引擎?")
print(response)
可正常回答