运行stable diffusion

这篇具有很好参考价值的文章主要介绍了运行stable diffusion。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、stable diffusion git下载代码

https://github.com/CompVis/stable-diffusion

安装环境ldm

2、下载模型

从网站中 CompVis (CompVis) 下载compvis的模型,有如下,下载模型如果有问题,运行中会提示错误。需要重新下载

stable diffusion源码运行,生成,stable diffusion

 3、运行

到1的主目录下,运行:其中init-img是自己选的图片,prompt是生成的提示词

python scripts/img2img.py --init-img demoimg/man3.png --n_samples 4 --outdir outputs/img2img/0 --ckpt models/ldm/stable-diffusion-v1-4/sd-v1-4.ckpt --prompt “a men in black, tied hair and waist, tall and fit, deep eyes and gnarled beard”

4、bug1:

img2img.py 53:  w, h = image.size

print(f"loaded input image of size ({w}, {h}) from {path}") # 158*162

最终resize到128*160,为32的倍数,然而有bug,size 问题,提示如下。

解决:w, h = map(lambda x: x - x % 64, (w, h))

改成64的倍数即可——这里是因为unet里有3次downsample,即unet的输入需要是8的倍数。若32则仅保证4倍

Traceback (most recent call last):
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/scripts/img2img.py", line 308, in <module>
    main()
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/scripts/img2img.py", line 271, in main
    samples = sampler.decode(z_enc, c, t_enc, unconditional_guidance_scale=opt.scale,
  File "/data/miniconda3/envs/env-novelai/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/ldm/models/diffusion/ddim.py", line 238, in decode
    x_dec, _ = self.p_sample_ddim(x_dec, cond, ts, index=index, use_original_steps=use_original_steps,
  File "/data/miniconda3/envs/env-novelai/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/ldm/models/diffusion/ddim.py", line 177, in p_sample_ddim
    e_t_uncond, e_t = self.model.apply_model(x_in, t_in, c_in).chunk(2)
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/ldm/models/diffusion/ddpm.py", line 987, in apply_model
    x_recon = self.model(x_noisy, t, **cond)
  File "/data/miniconda3/envs/env-novelai/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/ldm/models/diffusion/ddpm.py", line 1410, in forward
    out = self.diffusion_model(x, t, context=cc)
  File "/data/miniconda3/envs/env-novelai/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/cfs/cfs_dataV/workdir/Research_stage2/stable-diffusion/ldm/modules/diffusionmodules/openaimodel.py", line 751, in forward
    h = th.cat([h, hs.pop()], dim=1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 3 but got size 5 for tensor number 1 in the list.文章来源地址https://www.toymoban.com/news/detail-819786.html

到了这里,关于运行stable diffusion的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Stable Diffusion生成图片

    画质 masterpiece,best quality,illustration,extremely detail CG unity 8k wallpaper,ultra-detailed,depth of field 杰作,最佳质量,插图,极度详细的8K壁纸,超高详细度,景深 画风 Chinese ink painting,water color,oil painting,sketch,realistic 中国水墨画,水彩,油画,素描,写实 人物 1girl,solo,upper body,black hair,

    2024年02月07日
    浏览(29)
  • 使用stable diffusion生成图片

    requirements.txt 内容如下 保存为stable_diffusion.py并执行  

    2024年02月13日
    浏览(47)
  • Stable Diffusion 图像生成测试

    最近图像多模态生成模型特别火,简单尝试了下。 项目地址:GitHub - CompVis/stable-diffusion: A latent text-to-image diffusion model 由于本地GPU比较弱鸡,使用了Google的colab进行了简单尝试,colab地址: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb 被效果

    2024年02月16日
    浏览(35)
  • Stable Diffusion 生成高清图片

    记录一下使用 Stable Diffusion 生成高清图片使用的插件和过程。 打开 Stable Diffusion,单击 “扩展” = “从网址安装”, 输入下面项目,单击 “安装”, 扩展的 git 仓库网址: https://github.com/Coyote-A/ultimate-upscale-for-automatic1111 然后单击 “已安装\\\",确认 “ultimate-upscale-for-automatic1

    2024年02月08日
    浏览(93)
  • 使用stable diffusion 生成作品流程

      AOTUDL 云部署 1.算力市场选用RTX3090/RTX A5000 2.点击算法镜像noval ai 3.0和Lora scripts 配置python环境及其他 3.启动stable diffusion和Lora scripts 4.装配模型:可在如Civitai上下载标注有 CKPT 的模型,有模型才能作画。下载的模型放入下载后文件路径下的 models/Stable-diffusion 目录。 5.Stable D

    2024年02月10日
    浏览(28)
  • Stable diffusion游戏图标生成讲解

    hello大家好,这里是ai绘画刚上路的萌新张怼怼,专注训练游戏图标。今天教大家如何用 stable diffusion中的模型生成游戏图标中技能图标的图片。(新手教程,如有遗漏、不足之处还望大家包涵并指出,共同完善游戏图标生成教程) 先给大家看一下生成的忍者神龟和剑。 以上

    2024年02月09日
    浏览(27)
  • Stable Diffusion 如何生成字体拼图

    像我的微信头像这样的图片怎么生成呢?    首先准备一张白纸黑字的图,放到ControlNet里,然后选下面几项:    选好以后就可以出图了:  

    2024年02月12日
    浏览(32)
  • AMD GPU安装运行stable diffusion

    本文操作环境为Windows10/11+AMD AI绘画是一种利用人工智能技术进行绘画的方法。它可以通过机器学习算法来学习艺术家的风格,并生成类似于艺术家的作品。最近,AI绘画技术得到了很大的发展,许多公司和研究机构都在进行相关的研究和开发。例如,OpenAI最近推出了一个名为

    2024年02月05日
    浏览(39)
  • 〔022〕Stable Diffusion 之 生成视频 篇

    如果想将视频换成另一种风格,或者想将视频中的人物替换掉,可以使用 mov2mov 插件 插件地址: https://github.com/Scholar01/sd-webui-mov2mov 由于该插件未收录在扩展列表中,所以需要从网址安装

    2024年02月09日
    浏览(25)
  • stable diffusion扩展Deforum生成视频

    先要搭建sd webui环境, 然后进入界面 搜索Deforum,点击install等待安装即可,安装成功后重启webui,就能看到Deforum选项 此时,你可能会看到这个提示 ControlNet not found. Please install it :) 这是因为还需要另一个扩展 sd-webui-controlnet,方法同上 安装完重启webui红色提示就消失了 后面

    2024年02月11日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包