汕尾海湾 发表于 2024-9-1 14:10:30

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
https://i-blog.csdnimg.cn/blog_migrate/8501da8f267383398cf95464d77aca4c.png
根据版本下载对应的cuda
官网地点:https://developer.nvidia.com/cuda-toolkit-archive
https://i-blog.csdnimg.cn/blog_migrate/9bcedb5b46a159ffb6cf93a6c57a8d41.png
5.下载stable diffusion源码

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
这里拉代替码时间可能比力长
进入到stable diffusion项目里,使用conda activate激活情况,假如出现报错usage error 就执行conda init
https://i-blog.csdnimg.cn/blog_migrate/830dc54fbcd86bd4eeaaafc3e699071b.png
在当前项目目录下,执行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页面上
https://i-blog.csdnimg.cn/blog_migrate/4cb1d30426a406b1284ac1ce1787c0bc.png
左边输入照片形貌,点击右边的Generate即可生成图片
https://i-blog.csdnimg.cn/blog_migrate/3136555b321cafe044be247c5e8d4644.png
执行生成图片的时候假如报错
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
如许就可以自己绘图啦^^
https://i-blog.csdnimg.cn/blog_migrate/1f388516bb78b874cbc3ede9b476a738.png
总结

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

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: windows下使用midjourney (一)