windows下使用midjourney (一)

本文详细介绍了如何通过安装Anaconda、设置Python环境、安装CUDA、git和stablediffusion源码,以及解决可能出现的各种错误,来使用midjourney这款AI绘画工具生成图片的过程。
摘要由CSDN通过智能技术生成

一、midjourney是什么?

midjourney 是一款AI绘画工具,输入描述自动生成图片。

二、使用步骤

1.安装anaconda

安装之前先在cmd里输入conda看下有没有安装过,没有的话安装一下
安装完成之后,在安装目录下找到.condarc文件,修改文件里的内容,直接覆盖

channels:
 - defaults
show_channel_urls: true
default_channels:
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
 conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

完成后输入 conda clean -i 清除索引缓存,确保使用的是镜像站地址

2.设置python

conda create --name stable-diffusion-webui python=3.10.6

创建python环境
升级pip

python -m pip install --upgr2ade pip

如果出现报错:
AttributeError: 'HTTPResponse' object has no attribute 'strict'
就重新设置下载镜像

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

3.安装git

4.安装cuda

先查看电脑中cuda版本

nvidia-smi

在这里插入图片描述

根据版本下载对应的cuda
官网地址:https://developer.nvidia.com/cuda-toolkit-archive
在这里插入图片描述

5.下载stable diffusion源码

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

这里拉取代码时间可能比较长

进入到stable diffusion项目里,使用conda activate激活环境,如果出现报错usage error 就执行conda init
在这里插入图片描述
在当前项目目录下,执行webui-user.bat

如果出现报错RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
就在webui-user.bat文件里 第11行 加上

set COMMANDLINE_ARGS=--skip-torch-cuda-test

如果出现报错stderr: ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,< 3.10; 1.6.3 Requires-Python >=3.7,< 3.10; 1.7.0 Requires-Python >=3.7,< 3.10; 1.7.1 Requires-Python >=3.7,< 3.10 ERROR: Could not find a version that satisfies the requirement tb-nightly (from versions: none) ERROR: No matching distribution found for tb-nightly
重点是后面报错里表示了 tb-nightly没有相关匹配分布
换成阿里的源

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

之后再重新执行 webui-user.bat

6.开始画图

成功执行bat会自动跳转到127.0.0.1:7860页面上
在这里插入图片描述
左边输入照片描述,点击右边的Generate即可生成图片

在这里插入图片描述
执行生成图片的时候如果报错
SafetensorError: Error while deserializing header: MetadataIncompleteBuffer
解决方式:
下载https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main 中v1-5-pruned-emaonly.ckpt
从下面的地址下载ckpt文件,并保存至…\models\Stable-diffusion:

复制完之后 bat重新执行下
再次执行

如果报错
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'
那就在执行bat时候添加 webui.bat --precision full –no-half
如果上述没有用,就给webui-user.bat文件里加上–no-half

set COMMANDLINE_ARGS= --skip-torch-cuda-test --no-half

然后重新启动bat
这样就可以自己画图啦^^
在这里插入图片描述

总结

第一次使用midjourney画出的图都比较写实,不太清楚怎么才能画出卡通图片~~

  • 12
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值