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