stable difussion 模型和插件的安装 日期:2025-05-22 人气:1 上一篇我们介绍了stable diffusion如何安装,安装好了之后下一步就是设置大模型,网上有很多训练好的大模型我们可以直接下载使用,我使用的模型是`majicMIX realistic 麦橘写实`,大模型通常都是几个G,使用迅雷下载下来放到目录`stable-diffusion-webui\models\Stable-diffusion`中,stable diffusion webui启动时会自动加载模型 ### 模型加载问题 - 大模型资源最丰富的是Hugging Face,但是国内访问不了,需要使用国内镜像https://hf-mirror.com - 大模型体积很大推荐使用迅雷下载 - 错误`Can't load tokenizer for 'openai/clip-vit-large-patch14'`,这个也是Hugging Face不能访问的问题。解决办法是新建文件夹openai/clip-vit-large-patch14,从[hf-mirror.com](https://hf-mirror.com/openai/clip-vit-large-patch14/tree/main)将资源下载到此文件夹中 ### 插件安装 stable diffusion有丰富的插件,我们已实现将图片转成线稿的功能为例讲解一下插件的安装方法 #### 安装ControlNet插件 可以去github上看一下详细的说明 - Open "Extensions" tab. - Open "Install from URL" tab in the tab. - Enter https://github.com/Mikubill/sd-webui-controlnet.git to "URL for extension's git repository". - Press "Install" button. - Wait for 5 seconds, and you will see the message "Installed into stable-diffusion-webui\extensions\sd-webui-controlnet. Use Installed tab to restart". - Go to "Installed" tab, click "Check for updates", and then click "Apply and restart UI". (The next time you can also use these buttons to update ControlNet.) - Completely restart A1111 webui including your terminal. (If you do not know what is a "terminal", you can reboot your computer to achieve the same effect.) - Download models (see below). - After you put models in the correct folder, you may need to refresh to see the models. The refresh button is right to your "Model" dropdown. 英文差的直接看图吧 - 第一步克隆git仓库到本地  点击install可能要等待很长很长时间,因为github不稳定。下载完成之后的路径是`stable-diffusion-webui\extensions\sd-webui-controlnet`,也许下载完成之后,此页面也没有反应,等的不耐烦了可以去目录下看,或者点击check update如下图  - 第二步安装插件 点击上图中的按钮Apply and Restart UI,又是一个漫长的等待过程,因为这个插件依赖很多,等待很长时间没有反应多半是依赖安装超时,看看console窗口是否有超时,如果有关闭窗口,手动安装依赖,安装之前不要忘记切换到虚拟环境,例如 ``` venv/Script/activate pip install -U https://github.com/huchenlei/HandRefinerPortable/releases/download/v1.0.1/handrefinerportable-2024.2.12.0-py2.py3-none-any.whl --prefer-binary ``` 向上边的这个例子是从github中下载,可以使用迅雷先下载到本地然后运行 ``` pip install -U E:\XunleiDownload\handrefinerportable-2024.2.12.0-py2.py3-none-any.whl --prefer-binary ``` 这只是一个例子,哪个依赖安装失败了在console中都能看到 - 重新运行webui-user.bat,所有依赖安装完毕之后,重新启动,启动后会自动加载插件,如果还是有依赖没有安装成功,重复上一步骤直到所有依赖安装完毕。 #### 安装ControlNet 控制模型 - 下载控制模型 Canny。打开[镜像](https://hf-mirror.com/lllyasviel/ControlNet-v1-1/tree/main)将模型及其对应的 yaml 配置文件均下载下来,放到 stable-diffusion-webui\models\ControlNet 文件夹内 - 下载预处理器 dpt_hybrid-midas-501f0c75.pt。打开[镜像](https://hf-mirror.com/lllyasviel/Annotators/tree/main),下载好的文件放入指定文件夹:stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads\midas\dpt_hybrid-midas-501f0c75.pt 至此一切顺利的话就可以使用canny画线稿了。 标签: ai 上一篇:vscode使用Community Server Connector运行JDK1.8项目报错 下一篇:无NVIDIA 启动 stable diffusion webui 随便看看 2025-07-04 vscode使用Community Server Connector运行JDK1.8项目报错 2025-07-03 vscode中为maven项目指定java版本 2025-06-27 利用puppeteer将网页保存为pdf 2025-06-27 一天二十四时辰表 2025-06-27 家谱中儿子和父母的关系有哪些? 留言