AI大模型教程
一起来学习

windows下使用midjourney (一)

一、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.7,=3.7,=3.7,
重点是后面报错里表示了 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文件,并保存至…modelsStable-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画出的图都比较写实,不太清楚怎么才能画出卡通图片~~

文章来源于互联网:windows下使用midjourney (一)

相关推荐: Datawhale AI夏令营第四期魔搭- AIGC文生图方向 task01笔记

目录 分任务1:跑通baseline 第一步——搭建代码环境 第二步——报名赛事 第三步——在魔搭社区创建PAI实例 分任务2:相关知识学习以及赛题理解 赛题理解: 文生图基本认识: 1. Diffusion  Model(扩散模型) 2. LDMs(潜空间扩…

赞(0)
未经允许不得转载:5bei.cn大模型教程网 » windows下使用midjourney (一)
分享到: 更多 (0)

AI大模型,我们的未来

小欢软考联系我们