QAnything+Ollama搭建本地知识库

1、Ollama安装使用

参考我的另一篇博客:ollama + fastgpt 搭建免费本地知识库-CSDN博客

2、QAnything

概述:

QAnything (Question and Answer based on Anything) 是致力于支持任意格式文件或数据库的本地知识库问答系统,可断网安装使用。

您的任何格式的本地文件都可以往里扔,即可获得准确、快速、靠谱的问答体验。

目前已支持格式: PDF(pdf),Word(docx),PPT(pptx),XLS(xlsx),Markdown(md),电子邮件(eml),TXT(txt),图片(jpg,jpeg,png),CSV(csv),网页链接(html),更多格式,敬请期待...

纯Python环境安装:

conda create -n qanything-python python=3.10
conda activate qanything-python
git clone -b qanything-python https://github.com/netease-youdao/QAnything.git
cd QAnything
pip install -e .

启动运行QAnything:

# 本地已经启动了ollama,这里做个运行测试
# 因为我的ollama里没有安装llama3模型,所以修改一下run_for_ollama_api_in_M1_mac.sh的参数。改成使用qwen2:latest模型
#!/bin/bash
#bash scripts/base_run.sh -s "M1mac" -w 4 -m 19530 -q 8777 -o -b 'http://localhost:11434/v1' -k 'ollama' -n 'llama3' -l '4096'
bash scripts/base_run.sh -s "M1mac" -w 4 -m 19530 -q 8777 -o -b 'http://localhost:11434/v1' -k 'ollama' -n 'qwen2:latest' -l '4096'

# 启动运行
bash scripts/run_for_ollama_api_in_M1_mac.sh

报错了

报错信息如下:

(base) ➜  QAnything git:(qanything-python) ✗ bash scripts/run_for_ollama_api_in_M1_mac.sh
即将启动后端服务,启动成功后请复制[http://0.0.0.0:8777/qanything/]到浏览器进行测试。
运行qanything-server的命令是:
CUDA_VISIBLE_DEVICES=0 python3 -m qanything_kernel.qanything_server.sanic_api --host 0.0.0.0 --port 8777 --model_size 7B  --use_openai_api --openai_api_base http://localhost:11434/v1 --openai_api_key ollama --openai_api_model_name llama3 --openai_api_context_length 4096 --workers 4
LOCAL DATA PATH: /Users/renlibin/PythonProjects/QAnything/QANY_DB/content
LOCAL_RERANK_REPO: maidalun/bce-reranker-base_v1
LOCAL_EMBED_REPO: maidalun/bce-embedding-base_v1
2024-06-28 17:34:14,614 - modelscope - INFO - PyTorch version 2.1.2 Found.
2024-06-28 17:34:14,614 - modelscope - INFO - Loading ast index from /Users/renlibin/.cache/modelscope/ast_indexer
2024-06-28 17:34:14,614 - modelscope - INFO - No valid ast index found from /Users/renlibin/.cache/modelscope/ast_indexer, generating ast index from prebuilt!
2024-06-28 17:34:14,691 - modelscope - INFO - Loading done! Current index file version is 1.13.0, with md5 f0dca17f6b67762919fb8486c6f931f5 and a total number of 972 compone
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Coder.Ren

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值