running out of memory on introduction_to_stablediffusion.ipynb
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- jupyter-notebook, python, pytorch
调研方向
该 issue 位于 introduction_to_stablediffusion.ipynb,具体是在运行 base 和 refiner 模型的单元格中。首先,使用 T4 在 Colab 中检查 GPU 内存使用情况。查看模型加载和推理步骤;考虑减小 batch size、图像分辨率,或使用 gradient checkpointing 等内存优化技术。错误 trace 指向 PyTorch 中的 conv2d 操作。验证 PYTORCH_CUDA_ALLOC_CONF 等环境变量。逐步运行 notebook,并使用 torch.cuda.memory_summary 监控内存,这将有助于确定峰值使用量。
由索引模型根据 Issue 内容生成。
描述
Thanks for this notebook @rkdan ! This is great!
In introduction_to_stablediffusion.ipynb running on Google Colab with an instance of a T4 GPU, I am running out of memory.
My code is here:
I can run until here (where I get an error):
# run both experts
image_base = base(
prompt=prompt,
num_inference_steps=n_steps,
denoising_end=high_noise_frac,
output_type="latent",
).images
image_final = refiner(
prompt=prompt,
num_inference_steps=n_steps,
denoising_start=high_noise_frac,
image=image_base,
).images[0]
Error message is
---------------------------------------------------------------------------
OutOfMemoryError Traceback (most recent call last)
<ipython-input-8-410c6a79b4f8> in <cell line: 0>()
7 ).images
8
----> 9 image_final = refiner(
10 prompt=prompt,
11 num_inference_steps=n_steps,
17 frames
/usr/local/lib/python3.11/dist-packages/torch/nn/modules/conv.py in _conv_forward(self, input, weight, bias)
547 self.groups,
548 )
--> 549 return F.conv2d(
550 input, weight, bias, self.stride, self.padding, self.dilation, self.groups
551 )
OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB. GPU 0 has a total capacity of 14.74 GiB of which 306.12 MiB is free. Process 6006 has 14.44 GiB memory in use. Of the allocated memory 14.17 GiB is allocated by PyTorch, and 145.94 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
My code is here:
- 主要语言
- Jupyter Notebook
- 星标
- 21
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
acceleratescience/diffusion-models 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Add devcontainer 未关闭enhancement good first issue
难度 2/5 1-3 小时 新手友好度 25/100
acceleratescience/diffusion-models#10 · 已指派 1 人 ·
查看 acceleratescience/diffusion-models 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix impact:other issue-rating: 🌊 off-meta tidepool no-stale P2
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
0xPlaygrounds/rig#2584 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
danielmiessler/LifeOS#2232 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·