利用ollama和open-webui本地部署通义千问Qwen1.5-7B-Chat模型

目录

[1 安装ollama](#1 安装ollama)

[2 安装open-webui](#2 安装open-webui)

[2.1 镜像下载](#2.1 镜像下载)

[3 配置ollama的模型转换工具环境](#3 配置ollama的模型转换工具环境)

[3.1 下载ollama源码](#3.1 下载ollama源码)

[3.2 下载ollama子模块](#3.2 下载ollama子模块)

[3.3 创建ollama虚拟环境](#3.3 创建ollama虚拟环境)

[3.4 安装依赖](#3.4 安装依赖)

[3.5 编译量化工具](#3.5 编译量化工具)

[7 创建ollama模型](#7 创建ollama模型)

[8 运行模型](#8 运行模型)

参考文献:


1 安装ollama

bash 复制代码
curl -fsSL https://ollama.com/install.sh | sh

启动、关闭ollama

systemctl start ollama

systemctl stop ollama

systemctl restart ollama

systemctl status ollama

2 安装open-webui

bash 复制代码
git clone https://github.com/open-webui/open-webui.git
cd open-webui

这里open-webui的源码其实用不到,直接用下面的镜像就行。

2.1 镜像下载

官方没有在 docker hub 上发布镜像,而是发布在 ghcr.io,地址在 https://Github.com/open-webui/open-webui/pkgs/container/open-webui

bash 复制代码
docker pull ghcr.io/open-webui/open-webui:main

如果没有科学上网,很可能会拉不动,可以试试 docker 代理网站:https://dockerproxy.com/,但是会多几个步骤

bash 复制代码
# 如果拉不动的话加个代理
docker pull ghcr.dockerproxy.com/open-webui/open-webui:main

# 重命名镜像(如果是通过代理下载的)
docker tag ghcr.dockerproxy.com/open-webui/open-webui:main ghcr.io/open-webui/open-webui:main

# 删除代理镜像(如果是通过代理下载的)
docker rmi ghcr.dockerproxy.com/open-webui/open-webui:main

然后docker images可以看到镜像

bash 复制代码
docker run -d -p 3006:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui-chw --restart always ghcr.io/open-webui/open-webui:main
2c93ac3c6c911302d4d2926692a7bab64f607317938da71e53ff32798be801da

3 配置ollama的模型转换工具环境

3.1 下载ollama源码

bash 复制代码
git clone https://github.com/ollama/ollama.git
cd ollama

3.2 下载ollama子模块

bash 复制代码
git submodule init
git submodule update llm/llama.cpp

3.3 创建ollama虚拟环境

bash 复制代码
conda create -n ollama_chw python=3.11
conda activate ollama_chw

3.4 安装依赖

bash 复制代码
pip install -r llm/llama.cpp/requirements.txt

3.5 编译量化工具

bash 复制代码
make -C llm/llama.cpp quantize
如果编译llama.cpp的测试工具main,在llama.cpp目录执行make -j,会在当前目录生成main文件。
测试实验./main -m ./model_name

4 5 6 见私人博客

7 创建ollama模型

bash 复制代码
ollama create chw1.5 -f /data/chw/ollama_20240419/qwen1.5-7B/Modelfile

到了这一步之后,其实在open-webui上就可以看到这个模型了

8 运行模型

bash 复制代码
ollama run chw1.5

其实这个ollama run就相当于在命令行运行模型,但是我们这里是用open-webui,所以直接ollama create之后就可以用open-webui。

参考文献:

GitHub - ollama/ollama: Get up and running with Llama 3, Mistral, Gemma, and other large language models.

GitHub - open-webui/open-webui: User-friendly WebUI for LLMs (Formerly Ollama WebUI)

llama.cpp部署通义千问Qwen-14B_通义千问gguf model-CSDN博客

适配Ollama的前端界面Open WebUI | 半码博客
🚀 Getting Started | Open WebUI

相关推荐
brucelee1862 天前
Debian 安装 Ollama 教程
debian·ollama·open claw
将冲破艾迪i2 天前
【AI】部署及调用deepseek和qwen等大模型
人工智能·python·ollama·deepseek
gujunge3 天前
Spring with AI (5): 搜索扩展——向量数据库与RAG(下)
ai·大模型·llm·openai·qwen·rag·spring ai·deepseek
竹之却3 天前
【Ollama】解决 ollama 软件下载慢,模型下载慢的问题
代理·ollama·deepseek·openclaw·ollama 模型下载
gujunge5 天前
Spring with AI (4): 搜索扩展——向量数据库与RAG(上)
ai·大模型·llm·openai·qwen·rag·spring ai·deepseek
福大大架构师每日一题5 天前
ollama v0.18.2 发布!OpenClaw 安装优化、Claude 加速、MLX 量化全面升级
golang·ollama
碳基硅坊7 天前
Qwen3.5-4B 微调实战:LLaMA-Factory 打造医疗AI助手
人工智能·qwen·模型微调
JuckenBoy8 天前
Linux环境安装SGLang框架运行自选大模型(以Rocky9.7为例)
linux·运维·大模型·qwen·rocky·deepseek·sglang
razelan8 天前
本地大模型系列:2.通过API让本地大模型为你服务
人工智能·api·ollama·本地大模型
樂油8 天前
小龙虾OpenClaw本地部署(四)连接ollama模型(qwen3.5:0.8b为例)
ollama·openclaw