Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using negative prompt brakes SDXL txt2img #433

Closed
FinecoFinit opened this issue Dec 14, 2023 · 3 comments
Closed

Using negative prompt brakes SDXL txt2img #433

FinecoFinit opened this issue Dec 14, 2023 · 3 comments
Labels
pipeline/sdxl scope/api status/fixed issues that have been fixed and released

Comments

@FinecoFinit
Copy link

FinecoFinit commented Dec 14, 2023

Steps to reproduce:

  1. Set SDXL txt2img, use Euler A, prompt with negative prompt
  2. Make image
  3. Error happens:
[2023-12-14 19:14:50,365] WARNING: onnx-web worker: directml MainThread onnx_web.diffusers.load: error while enabling auto attention slicing: 'ORTStableDiffusionXLPipeline' object has no attribute 'enable_attention_slicing'
[2023-12-14 19:14:52,756] ERROR: onnx-web worker: directml MainThread onnx_web.chain.pipeline: error while running stage pipeline, 1 retries left
Traceback (most recent call last):
  File "D:\@home\fifi\Documents\onnx-web\api\onnx_web\chain\pipeline.py", line 227, in __call__
    stage_result = stage_pipe.run(
  File "D:\@home\fifi\Documents\onnx-web\api\onnx_web\chain\source_txt2img.py", line 144, in run
    result = pipe(
  File "D:\@home\fifi\Documents\onnx-web\api\onnx_env\lib\site-packages\optimum\onnxruntime\modeling_diffusion.py", line 590, in __call__
    return StableDiffusionXLPipelineMixin.__call__(self, *args, **kwargs)
  File "D:\@home\fifi\Documents\onnx-web\api\onnx_env\lib\site-packages\optimum\pipelines\diffusers\pipeline_stable_diffusion_xl.py", line 434, in __call__
    prompt_embeds = np.concatenate((negative_prompt_embeds, prompt_embeds), axis=0)
  File "<__array_function__ internals>", line 180, in concatenate
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 3 dimension(s)

You will get same error even after removing negative prompt, restarting API helps to resolve error

@FinecoFinit FinecoFinit changed the title Certain schedulers using SDXL txt2img breaks api Brackets brakes SDXL txt2img Dec 14, 2023
@FinecoFinit FinecoFinit changed the title Brackets brakes SDXL txt2img Using negative prompt brakes SDXL txt2img Dec 14, 2023
@ssube ssube added status/new issues that have not been confirmed yet scope/api pipeline/sdxl labels Dec 15, 2023
@ssube
Copy link
Owner

ssube commented Dec 15, 2023

I tested this with Euler A and a few other schedulers, but I'm not able to reproduce it:

image

{
  "input_size": {
    "width": 1024, 
    "height": 1024
  }, 
  "outputs": "txt2img_2045114381_b759c25db9a9fba9815472c4be2bc8e8eb29c2a9f0241fd66f4e30c9e049798b_1702606569_0.png", 
  "params": {
    "model": "diffusion-sdxl-cotton-candy-3d", 
    "pipeline": "txt2img-sdxl", 
    "scheduler": "euler-a", 
    "prompt": "a cute puppy dog", 
    "negative_prompt": "cat, cows, sheep, fish, zebras", 
    "cfg": 4.0, 
    "seed": 2045114381, 
    "steps": 50, 
    "eta": 0.0, 
    "batch": 1, 
    "control": "", 
    "input_prompt": "a cute puppy dog", 
    "input_negative_prompt": "cat, cows, sheep, fish, zebras", 
    "loopback": 0, 
    "tiled_vae": false, 
    "unet_overlap": 0.75, 
    "unet_tile": 1024, 
    "vae_overlap": 0.25, 
    "vae_tile": 512, 
    "denoise": 3
  }, 
  "highres": {
    "enabled": false, "iterations": 1, "method": "bilinear", "scale": 1, "steps": 1, "strength": 0.1
  }, 
  "upscale": {
    "upscale_model": "upscaling-swinir-real-x2", "correction_model": "correction-codeformer", "denoise": 0.5, "faces": false, "face_outscale": 1, "face_strength": 0.5, "format": "onnx", "outscale": 1, "pre_pad": 0, "scale": 1, "tile_pad": 10, "upscale_order": "correction-first"
  }, 
  "size": {
    "width": 1024, "height": 1024
  }
}

I do recall pushing a fix for a similar issue to optimum a while back (huggingface/optimum#1339), so it's possible something is out of date, possibly. I've updated the base requirements with the latest versions of diffusers and optimum, which are working well for me. Can you try updating to those versions and see if this is still happening?

@FinecoFinit
Copy link
Author

@ssube

The conflict is caused by:
    The user requested huggingface-hub==0.16.4
    accelerate 0.25.0 depends on huggingface-hub
    controlnet-aux 0.0.2 depends on huggingface-hub
    datasets 2.15.0 depends on huggingface-hub>=0.18.0

Went smooth with huggingface-hub==0.19.4, problem fixed

@ssube
Copy link
Owner

ssube commented Dec 16, 2023

I thought I had included huggingface-hub in the pip upgrade, but I'll bump that version as well before the release.

@ssube ssube added status/fixed issues that have been fixed and released and removed status/new issues that have not been confirmed yet labels Dec 16, 2023
@ssube ssube closed this as completed Dec 16, 2023
ssube added a commit that referenced this issue Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pipeline/sdxl scope/api status/fixed issues that have been fixed and released
Projects
None yet
Development

No branches or pull requests

2 participants