{
  "schema_version": "1.0",
  "id": "T-18b96cead4c7",
  "url": "https://gpuatlas.top/articles/T-18b96cead4c7/",
  "title": "给 Qwen2.5 7B 做 QLoRA，怎么估算自己显存够不够？",
  "summary": "Qwen2.5 7B QLoRA按7.61B实际基础加状态与激活预算，理想3.805GB只是低位原始数据。",
  "language": "zh-Hans",
  "category": {
    "id": "c-18",
    "name": "模型微调",
    "url": "https://gpuatlas.top/categories/c-18/"
  },
  "topics": [
    {
      "id": "model-39f632df4c",
      "name": "Qwen2.5",
      "kind": "model",
      "description": "已有 Qwen2.5 模型想在本地运行？按显存档位比较量化与上下文设置，并查看训练相关的资源问题。",
      "url": "https://gpuatlas.top/topics/model-39f632df4c/"
    }
  ],
  "body_text": "给Qwen2.5 7B做QLoRA时，先固定具体基础模型与训练工具。以Qwen2.5-7B-Instruct为例，实际约7.61B参数，统一按4bit计算的原始权重约3.805GB；元数据、未量化部分与加载布局尚未计入，不能把它当作训练总需求。\n\n基础通常冻结，适配器仍需参数、梯度与优化器状态，模块、rank和状态精度影响大小。长度、微批量与实现影响反向激活及缓冲，这些不自动跟基础权重变成低位。\n\n按支持流程准备并核可训练参数，用真实处理后样本完成前向、反向和更新。模型加载成功只证明部分环节，推理KV不能预测训练，模板和答案损失范围也要检查。\n\n基础不足先核精度布局，反向不足再比较微批量、长度组织、检查点或受支持分片。梯度累积不让单条过长输入自动装下，重计算、通信、主存和保存汇总要计入完整时间。\n\n完整更新后，把Qwen2.5-7B-Instruct适配器在新进程恢复，用未训练过的日常问题和数字题比较原基础。若恢复时才出现不足，原先的预算尚未覆盖全部阶段；若只在目标任务上退步，再检查训练数据。不能用约3.805GB的理想基础权重或文件压缩比例推断训练省显存幅度。",
  "published_at": null,
  "modified_at": "2026-11-26T15:17:38.690397+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "qwen25-7b",
      "url": "https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/raw/main/README.md",
      "retrieved_at": "2026-11-25T11:18:40.540160+00:00"
    },
    {
      "id": "qwen25-7b-config",
      "url": "https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/resolve/main/config.json",
      "retrieved_at": "2026-11-25T11:18:40.540160+00:00"
    },
    {
      "id": "peft-quantization",
      "url": "https://raw.githubusercontent.com/huggingface/peft/main/docs/source/developer_guides/quantization.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    },
    {
      "id": "transformers-training-memory",
      "url": "https://raw.githubusercontent.com/huggingface/transformers/main/docs/source/en/model_memory_anatomy.md",
      "retrieved_at": "2026-11-25T10:16:15.738480+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-18b96cead4c7/",
    "json": "https://gpuatlas.top/data/articles/T-18b96cead4c7.json",
    "markdown": "https://gpuatlas.top/data/articles/T-18b96cead4c7.md"
  }
}
