本地/笔记本/纯 cpu 部署、使用类 gpt 大模型

文章目录

    • [1. 安装 web UI](#1. 安装 web UI)
      • [1.1. 下载代码库](#1.1. 下载代码库)
      • [1.2. 创建 conda 环境](#1.2. 创建 conda 环境)
      • [1.3. 安装 pytorch](#1.3. 安装 pytorch)
      • [1.4. 安装 pip 库](#1.4. 安装 pip 库)
    • [2. 下载大模型](#2. 下载大模型)
    • [3. 使用 web UI](#3. 使用 web UI)
      • [3.1. 运行 UI 界面](#3.1. 运行 UI 界面)
      • [3.2. 加载模型](#3.2. 加载模型)
      • [3.3. 进行对话](#3.3. 进行对话)

使用 web UI + 大模型文件,即可在笔记本上部署、使用类 gpt 大模型。

1. 安装 web UI

1.1. 下载代码库

https://github.com/oobabooga/text-generation-webui

1.2. 创建 conda 环境

sh 复制代码
conda create -n textgen python=3.11
conda activate textgen

1.3. 安装 pytorch

文档:https://github.com/oobabooga/text-generation-webui#2-install-pytorch

System GPU Command
Linux/WSL NVIDIA pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Linux/WSL CPU only pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
Linux AMD pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6
MacOS + MPS Any pip3 install torch torchvision torchaudio
Windows NVIDIA pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Windows CPU only pip3 install torch torchvision torchaudio

1.4. 安装 pip 库

文档:https://github.com/oobabooga/text-generation-webui#3-install-the-web-ui

sh 复制代码
pip install -r <requirements file according to table below>
GPU CPU requirements file to use
NVIDIA has AVX2 requirements.txt
NVIDIA no AVX2 requirements_noavx2.txt
AMD has AVX2 requirements_amd.txt
AMD no AVX2 requirements_amd_noavx2.txt
CPU only has AVX2 requirements_cpu_only.txt
CPU only no AVX2 requirements_cpu_only_noavx2.txt
Apple Intel requirements_apple_intel.txt
Apple Apple Silicon requirements_apple_silicon.txt

2. 下载大模型

TheBloke: https://huggingface.co/TheBloke

TheBloke 是 hugging face 社区的一个用户, ta 提供了许多预量化大模型的下载。

  • 量化:将模型权重中的 float 替换为 int 等数据类型,损失一小部分精度,但减少内存占用、计算开销。

在该用户的 model 库中搜索需要的模型,常用关键词是 7b-gguf

  • 其中 7b 代表模型的参数量 7 billion(常见参数量有 7b , 13b , 70b),参数量越大,模型精度越高,即对话质量越高。
  • gguf 是一个预量化大模型的格式,支持 cpu 、 gpu 共同加载模型,被广泛使用

在具体模型页面的 Provided files 部分可以看到该模型的不同量化版本、文件大小、预计内存占用、推荐与否。点击具体量化版本的模型即可下载。

3. 使用 web UI

3.1. 运行 UI 界面

打开 conda 命令行窗口,运行以下命令,并保持窗口开启:

sh 复制代码
conda activate textgen
cd text-generation-webui
python server.py

3.2. 加载模型

打开 127.0.0.1:7860 网页链接,model 页面,按上图进行模型加载即可(大概需要几十秒)。

具体文档:https://github.com/oobabooga/text-generation-webui/wiki/04-‐-Model-Tab#llamacpp

3.3. 进行对话

打开 chat 页面,即可进行对话。

  • 在对话框左侧菜单中有 "开始新对话" 等操作
  • 需注意,大部分模型默认语言为英文(可在模型页面查看详情)
  • 本地模型无法联网
相关推荐
jarvisuni9 小时前
开发“360安全卫士”,Opus4.6把GPT5.3吊起来打了?!
人工智能·gpt·ai编程
wukangjupingbb11 小时前
Gemini 3和GPT-5.1在多模态处理上的对比
人工智能·gpt·机器学习
-嘟囔着拯救世界-12 小时前
【2026 最新版】OpenAI 祭出王炸 GPT-5.3-Codex!Win11 + VSCode 部署保姆级教程
vscode·gpt·chatgpt·node.js·node·codex·gpt5
五月君_1 天前
炸裂!Claude Opus 4.6 与 GPT-5.3 同日发布:前端人的“自动驾驶“时刻到了?
前端·gpt
l1t1 天前
DeepSeek总结的PostgreSQL的GPT推理SQL移植到DuckDB的性能优化方法
sql·gpt·postgresql
程序员Sunday1 天前
说点不一样的。GPT-5.3 与 Claude Opus 4.6 同时炸场,前端变天了?
前端·gpt·状态模式
刘大大Leo2 天前
GPT-5.3-Codex 炸了:第一个「自己造自己」的 AI 编程模型,到底意味着什么?
人工智能·gpt
acai_polo3 天前
如何在国内合规、稳定地使用GPT/Claude/Gemini API?中转服务全解析
人工智能·gpt·ai·语言模型·ai作画
迈火4 天前
SD - Latent - Interposer:解锁Stable Diffusion潜在空间的创意工具
人工智能·gpt·计算机视觉·stable diffusion·aigc·语音识别·midjourney
空中楼阁,梦幻泡影4 天前
主流4 大模型(GPT、LLaMA、DeepSeek、QWE)的训练与推理算力估算实例详细数据
人工智能·gpt·llama