Ale*_*x S 9 python generative-art pytorch
我在这里安装了稳定扩散的 GUI 版本。有了它,我能够使用具有 8 GB 内存的 GeForce RTX 3070 GPU 制作 512 x 512 像素的图像:
但是,当我尝试使用命令行界面执行相同的操作时,内存不足:
输入:
>> C:\SD\stable-diffusion-main>python scripts/txt2img.py --prompt "a close-up portrait of a cat by pablo picasso, vivid, abstract art, colorful, vibrant" --plms --n_iter 3 --n_samples 1 --H 512 --W 512
错误:
RuntimeError: CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 8.00 GiB total capacity; 6.13 GiB already allocated; 0 bytes free; 6.73 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
如果我将图像尺寸减小到 256 X 256,它会给出结果,但质量显然要低得多。
因此,我的问题的第 1 部分是,当卡上有 8 GiB 时,为什么我会在 6.13 GiB 时耗尽内存,第 2 部分是 GUI 做了什么不同的操作以允许 512 x 512 输出?我可以更改设置以减少 GPU 的负载吗?
非常感谢,亚历克斯
这可能不是唯一的答案,但我通过使用此处的优化版本解决了它。如果您已经安装了标准版本,只需将“OptimizedSD”文件夹复制到现有文件夹中,然后运行优化的 txt2img 脚本而不是原始脚本:
>> python optimizedSD/optimized_txt2img.py --prompt "a close-up portrait of a cat by pablo picasso, vivid, abstract art, colorful, vibrant" --H 512 --W 512 --seed 27 --n_iter 2 --n_samples 10 --ddim_steps 50
它在我的计算机上速度相当慢,但可以生成 512 X 512 的图像!
谢谢,亚历克斯
归档时间: |
|
查看次数: |
22647 次 |
最近记录: |