标签: stable-diffusion

我运行稳定扩散,这是错误的 RuntimeError: "LayerNormKernelImpl" not Implemented for 'Half',

我运行稳定扩散,这是错误的 RuntimeError:“LayerNormKernelImpl”未实现“Half”,请帮助我,我该怎么办?

我不知道

stable-diffusion

21
推荐指数
4
解决办法
6万
查看次数

ModuleNotFoundError:在 Macbook M2 Max 上安装 xformers 进行稳定扩散时,没有名为“torch”的模块

我正在研究稳定扩散并尝试安装 xformers 来训练我的 Lora。

\n

我的电脑是Macbook M2 Max并且已经安装了最新的python3.11和pip 23.1.2

\n
which python3\n/Library/Frameworks/Python.framework/Versions/Current/bin/python3\npython3 -V                                                                             \nPython 3.11.3\n\nwhich pip3\n/Library/Frameworks/Python.framework/Versions/Current/bin/pip3\npip3 -V\npip 23.1.2 from /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip (python 3.11)\n
Run Code Online (Sandbox Code Playgroud)\n

但每次我使用下面的cmd时:

\n
pip3 install xformers\n
Run Code Online (Sandbox Code Playgroud)\n

我会收到如下消息:

\n
Collecting xformers\n  Using cached xformers-0.0.20.tar.gz (7.6 MB)\n  Installing build dependencies ... done\n  Getting requirements to build wheel ... error\n  error: subprocess-exited-with-error\n  \n  \xc3\x97 Getting requirements to build wheel did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [21 lines of output]\n      Traceback (most recent call last):\n        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line …
Run Code Online (Sandbox Code Playgroud)

python pip torch stable-diffusion

7
推荐指数
0
解决办法
1601
查看次数

Diffusers SDXL“TypeError:‘NoneType’类型的参数不可迭代”

刚刚访问了 SDXL 模型,希望对其即将发布的版本进行测试...不幸的是,我们当前用于服务的代码似乎不适用于stabilityai/stable-diffusion-xl-base-0.9,并且我不完全确定 SDXL 有何不同以及我需要什么改变。

我们使用不同的管道,以便可以生成图像预览,因此它不是 SDXL 模型自述文件中提供的典型模板。该错误似乎发生在unet_2d_condition.py(在扩散器库中)

Traceback (most recent call last):
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 159, in <module>
    socker_listener.generate_image()
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 154, in generate_image
    foo = self.blocking_code()
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 109, in blocking_code
    noise_pred = self.unet(latent_model_input, t,
  File "C:\Users\myalt\Desktop\testing image grid\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\myalt\Desktop\testing image grid\venv\lib\site-packages\diffusers\models\unet_2d_condition.py", line 839, in forward
    if "text_embeds" not in added_cond_kwargs:
TypeError: argument of type 'NoneType' is not …
Run Code Online (Sandbox Code Playgroud)

python torch stable-diffusion

7
推荐指数
1
解决办法
2732
查看次数

在生成最终图像之前获取图像迭代 StableDiffusionPipeline.pretrained

我目前正在使用diffusers StableDiffusionPipeline(来自拥抱的脸)通过我和朋友一起使用的不和谐机器人生成人工智能图像。我想知道是否可以在完成之前预览正在生成的图像?

例如,如果生成一张图像需要 20 秒,因为它使用扩散,所以它一开始会很模糊,然后逐渐变得越来越好。我想要的是在每次迭代(或每隔几秒)保存图像并查看它的进展情况。我怎样才能做到这一点?

class ImageGenerator:
    def __init__(self, socket_listener, pretty_logger, prisma):
        self.model = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16, use_auth_token=os.environ.get("HF_AUTH_TOKEN"))
        self.model = self.model.to("cuda")

    async def generate_image(self, data):
        start_time = time.time()
        with autocast("cuda"):
            image = self.model(data.description, height=self.default_height, width=self.default_width,
                               num_inference_steps=self.default_inference_steps, guidance_scale=self.default_guidance_scale)
            image.save(...)
Run Code Online (Sandbox Code Playgroud)

我目前拥有的代码是这样的,但是它仅在完全完成时返回图像。我试图研究图像是如何在 StableDiffusionPipeline 内部生成的,但我找不到生成图像的任何地方。如果有人可以提供任何关于我可以从哪里开始的指示/提示,那将非常有帮助。

python torch huggingface stable-diffusion

5
推荐指数
1
解决办法
1613
查看次数

无法从“diffusers.utils”导入名称“randn_tensor”

在此输入图像描述

我正在使用这个 autotrain 协作,当我标记并将图像放入图像文件夹并尝试运行它时,它说这个错误,我该如何解决这个问题?

重现:

  1. 点击 ipynb 的链接

  2. 新建一个文件夹名称为images

  3. 添加一些图像并将提示替换为描述您的图像的内容

  4. 转到运行时并运行所有

ipynb 链接

python machine-learning huggingface stable-diffusion

2
推荐指数
1
解决办法
2062
查看次数

使用 python 3.10.6 初始化稳定扩散时出错。“str”对象没有属性“isacii”

我正在尝试从 GIT https://github.com/AUTOMATIC1111/stable-diffusion-webui设置 Stable Diffusion 1.5 。我遵循了教程https://www.youtube.com/watch?v=ycQJDJ-qNI8&t=0s

为了避免多个 python 版本出现问题,我删除了较旧的 Python 版本并仅安装了 Python 3.10.6,然后仅安装了 3.10.9,但两个版本都收到相同的错误。

当我调用 web-user.bat 进行初始化时。蝙蝠调用 webui.bat,我收到此错误:

Python 3.10.9
venv "D:\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
  File "C:\Users\XX\AppData\Local\Programs\Python\Python310\lib\encodings\__init__.py", line 85, in search_function
  File "C:\Users\XX\AppData\Local\Programs\Python\Python310\lib\encodings\__init__.py", line 64, in normalize_encoding
AttributeError: 'str' object has no attribute 'isascii'
Premere un tasto per continuare . . .
Run Code Online (Sandbox Code Playgroud)

我发现这个错误是由于使用旧的 python 版本造成的,但我使用的是 3.10。

谢谢

python encoding python-3.10 stable-diffusion

1
推荐指数
1
解决办法
5298
查看次数

如何在 Mac Intel 上从 AUTOMATIC1111 安装稳定的 Diffusion Web UI?

我最近尝试在我的 Mac Intel 上使用 AUTOMATIC1111 的稳定扩散 Web UI。没有针对 Mac Intel 的文档,当我尝试使用为其他平台提供的方法时,我最终遇到了与 LZMA 相关的 Python 异常:

ModuleNotFoundError: No module named '_lzma'
Run Code Online (Sandbox Code Playgroud)

感谢这个堆栈溢出帖子,我能够解决这个问题。这使我能够为 Mac Intel 编写安装指南/文档,并在我的答案中分享。

我的配置:

  • MacBook Pro 2019
  • CPU 2.6 GHz 6 核 Intel Core i7
  • GPU 英特尔超高清显卡 630 1536 MB
  • 内存 32 GB 2667 MHz DDR4
  • 系统 macOS Ventura 13.2.1

python macos artificial-intelligence stable-diffusion

1
推荐指数
1
解决办法
3497
查看次数

如何确保 .nonzero() 返回一个元素张量?

[编辑以包含原始源代码]

我尝试运行在这里找到的代码:https://colab.research.google.com/drive/1roZqqhsdpCXZr8kgV_Bx_ABVBPgea3lX ?usp=sharing(链接自:https: //www.youtube.com/watch ?v=-lz30by8 -sU )

!pip install transformers diffusers lpips accelerate
from huggingface_hub import notebook_login
notebook_login()

import torch
from transformers import CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, UNet2DConditionModel, LMSDiscreteScheduler
from tqdm.auto import tqdm
from torch import autocast
from PIL import Image
from matplotlib import pyplot as plt
import numpy
from torchvision import transforms as tfms

# For video display:
from IPython.display import HTML
from base64 import b64encode

# Set device
torch_device = "cuda" if torch.cuda.is_available() else "cpu" …
Run Code Online (Sandbox Code Playgroud)

python torch stable-diffusion

0
推荐指数
1
解决办法
319
查看次数