分页: 1 / 1

[整理]对普通人来说,Stable diffusion 和 Midjourney 怎么选?

发表于 : 2023年04月09日 19:43
523066680

对普通人来说,Stable diffusion 和 Midjourney 怎么选?

https://www.zhihu.com/question/59349796 ... 2972849204

其实没那么复杂,stable diffusion跑在本地,你想用多刺激的词就用多刺激的词,随便什么花样都能玩。
但是midjourney是跑在别人家的服务器上,很多词是不可以用的。


mj最搞笑的一个规矩是:如果你生成了他们不允许你生成的图,可以不退款封号(除了颜色以外还有特朗普那些),但是AI模型本来就不太可控


小白才喜欢mj,傻瓜式操作,有点动手能力的早就本地部署sd了,自由度高,模型随便换,私密性还好

喂饭级stable_diffusion_webUI使用教程

well 用python 3.10.6 运行 webui.bat ,安装多个模块后,clip 那一步安装失败
打开stable diffusion webui时,提示缺少clip或clip安装不上的解决方案(windows下的操作)

原因:stable diffusion webui环境中的clip其实是open_clip,不能用pip install clip安装
解决方法是直接到github下载 open_clip 代码到本地,并进行本地安装。


Re: [整理]对普通人来说,Stable diffusion 和 Midjourney 怎么选?

发表于 : 2023年04月09日 22:20
523066680

RuntimeError: Couldn't clone Stable Diffusion.
Command: "git" clone "https://github.com/Stability-AI/stablediffusion.git" "E:\Temp\stable-diffusion-webui\repositories\stable-diffusion-stability-ai"
Error code: 128
stdout: <empty>
stderr: Cloning into 'E:\Temp\stable-diffusion-webui\repositories\stable-diffusion-stability-ai'...
fatal: unable to access 'https://github.com/Stability-AI/stablediffusion.git/': OpenSSL SSL_read: Connection was reset, errno 10054

尝试:
手动 git clone https://github.com/Stability-AI/stablediffusion.git
发现速度太慢,从gitee寻找到:
https://gitee.com/jerrylinkun/stable-di ... tee_search
https://gitee.com/ExMikuPro/stablediffu ... tee_search

https://www.bilibili.com/read/cv22604427


Re: [整理]对普通人来说,Stable diffusion 和 Midjourney 怎么选?

发表于 : 2023年04月10日 00:08
523066680

中间因为别的原因开了 v2ray 代理
webui 界面总是提示:
Something went wrong Expecting value: line 1 column 1

加载模型文件也总是提示错误,感到莫名其妙
查到一篇文章说需要设置代理:https://www.bilibili.com/read/cv19991459

那我想可能是本地开了v2ray导致一些问题,关掉后就正常了。


OpenSSL SSL_read: Connection was reset

发表于 : 2023年04月10日 00:10
523066680

OpenSSL SSL_read: Connection was reset

运行 webui-user.bat,自动clone 关联模块时,反复出现这个问题.

  1. 改为 手动 git clone 相关模块
  2. 从 gitee 搜索同名仓库,提高下载速度

AttributeError: module 'clip' has no attribute 'load'

发表于 : 2023年04月10日 12:57
523066680

https://blog.csdn.net/weixin_54227557/a ... /127934820
https://tieba.baidu.com/p/8197575413

pip install git+https://github.com/openai/CLIP.git
问题依旧

测试样例

代码: 全选

import torch
import clip
from PIL import Image

device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)

image = preprocess(Image.open("CLIP.png")).unsqueeze(0).to(device)
text = clip.tokenize(["a diagram", "a dog", "a cat"]).to(device)

with torch.no_grad():
    image_features = model.encode_image(image)
    text_features = model.encode_text(text)
    
logits_per_image, logits_per_text = model(image, text) probs = logits_per_image.softmax(dim=-1).cpu().numpy() print("Label probs:", probs) # prints: [[0.9927937 0.00421068 0.00299572]]

pip uninstall clip
然后重新
pip install clip
测试样例的时候需要下载300M左右的包,速度慢,上梯子后测试通过


[视频]stable diffusion训练embedding和hypernetwork详解

发表于 : 2023年04月10日 15:59
523066680

训练数据集,显示 CUDA out of memory

发表于 : 2023年04月10日 18:06
523066680

训练 embeddings 数据集时,出现 CUDA out of memory 错误提示

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB (GPU 0; 4.00 GiB total capacity; 2.45 GiB
already allocated; 0 bytes free; 3.12 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try se
tting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

搜索和尝试
https://blog.csdn.net/MirageTanker/arti ... /127998036
https://blog.csdn.net/PromiseTo/article ... /127240779
Stable Diffusion 本地部署教程
https://stackoverflow.com/questions/591 ... in-pytorch

E:\Temp\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\scripts\txt2img.py

代码: 全选

    parser.add_argument(
        "--n_samples",
        type=int,
        default=3,
        help="how many samples to produce for each given prompt. A.k.a batch size",
    )

将其中3改为1

2.

代码: 全选

    config = OmegaConf.load(f"{opt.config}")
    device = torch.device("cuda") if opt.device == "cuda" else torch.device("cpu")
    model = load_model_from_config(config, f"{opt.ckpt}", device)

改为

代码: 全选

    config = OmegaConf.load(f"{opt.config}")
    device = torch.device("cuda") if opt.device == "cuda" else torch.device("cpu")
    model = load_model_from_config(config, f"{opt.ckpt}", device).half()

最后,只出图还是没问题的。
但是如果要自己训练数据集,4G显存就不够用了.