- 基于langchain+local model(llama-2-13b.gguf.q4_0.bin)搭建简单的RAG系统: localrum.py
- RAG 完整流程和基于图片的RAG系统搭建: demo.ipynb
RAG流程图:
知识库流程图:
- Ollama 可以在 Windows 上运行了
- Ollama 支持同时加载多个模型,单个模型同时处理多个请求
- xinference + dify + ollama 构建本地知识库
- FastGPT + OneAPI + xinferencce + ollama 构建本地知识库
- dify+ollama构建本地大模型平台
环境搭建
- wsl2 + docker
- 关闭防火墙
启动流程
-
首先启动ollama:
ollama run MODEL_NAME -
本地clone dify仓库:
git clone https://github.com/langgenius/dify.git -
进入下载后的文件夹中的docker文件夹:
cd dify/docker -
启动docker:
docker compose up -d第一次启动,因为要下载Images,需要等一段时间。启动后查看Docker Desktop的界面:

如果需要修改配置,可以参考:https://docs.dify.ai/v/zh-hans/getting-started/install-self-hosted/environments 修改docker-compose.yaml文件。
-
启动成功后访问127.0.0.1
登陆邮箱: 945183225@qq.com
密码: root1234
账户名: root
-
绑定Ollama首先本地启用,嵌入选择url:
http://host.docker.internal:11434 -
后续操作参考: dify+ollama构建本地大模型平台
- 首先本地启动
ollama serve - 运行
Project/chat_ollama_multimodel.py
- 下载FastChat:
git clone https://github.com/lm-sys/FastChat.git
cd FastChat
if you runnning on MAC:brew install rust cmake - 安装包:
pip3 install --upgrade pip # enable PEP 660 support
pip3 install -e ".[model_worker,webui]" - 下载两个模型:
git lfs install
git clone https://huggingface.co/lmsys/vicuna-7b-v1.5
git clone https://huggingface.co/lmsys/longchat-7b-v1.5-32k - (可选)终端交互试下能否运行:
python3 -m fastchat.serve.cli --model-path lmsys/vicuna-7b-v1.5 - 启动控制器服务:
python -m fastchat.serve.controller --host 0.0.0.0 - 启动Worker服务:
第一个模型:CUDA_VISIBLE_DEVICES=0
python -m fastchat.serve.model_worker --model-path ../vicuna-7b-v1.5 --controller http://localhost:21001 --port 31000 --worker http://localhost:31000
第二个模型:CUDA_VISIBLE_DEVICES=1
python -m fastchat.serve.model_worker --model-path ../longchat-7b-v1.5-32k --controller http://localhost:21001 --port 31001 --worker http://localhost:31001 - 启动 RESTFul API 服务:
python -m fastchat.serve.openai_api_server --host 0.0.0.0
可以通过访问http://127.0.0.1:8000/docs可以查看接口信息
- WebUI部署:
python -m fastchat.serve.gradio_web_server_multi
访问127.0.0.1:7860访问UI界面,选择side-by-side下图红色方框




