低显存使用NovelAI的方法
繁星深空
2022年10月10日 04:53

问题描述:

NovelAI若使用显存较低的显卡会报错,例如(我的显卡是GeForce MAX250, 2G显存):

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 2.00 GiB total capacity; 1.68 GiB already allocated; 0 bytes free; 1.72 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

解决方法:

在stable-diffusion-webui文件夹下找到webui-user.bat,其内容如下:

@echo off set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS= call webui.bat

在上述文件中的“set COMMANDLINE_ARGS=”后根据自己显卡的显存选择下面的参数填入

4G显存:--precision full --no-half --lowvram --always-batch-cond-uncond 6G显存:--precision full --no-half --medvram 低于5G显存:--medvram 低于3G显存:--lowvram --always-batch-cond-uncond

参考:

NovelAI泄露模型 环境搭建 - 知乎 (zhihu.com) (安装webui时应挂梯子)

AI小画家本地部署简单上手(更新NovelAI整合包) - 卓明谷 - Stage1st - stage1/s1 游戏动漫论坛 (saraba1st.com)