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

How can i change generate image size? #9

Open
s-show opened this issue Oct 9, 2022 · 2 comments
Open

How can i change generate image size? #9

s-show opened this issue Oct 9, 2022 · 2 comments

Comments

@s-show
Copy link

s-show commented Oct 9, 2022

I am using Stable Diffusion in this branch to generate images, but I get an error when I try to generate a 768x512 size image.

The code to generate the image is as follows

prompt = "1girl, \
blue eyes, \
cat ears, \
full body, \
looking at viewer, \
school uniform, \
simple background, \
silver long hair, \
under rim eyewear, \
white background"

image = pipe(prompt, height=768, width=512, num_inference_steps=50, guidance_scale=7.5, eta=0.0, execution_provider="DmlExecutionProvider")["sample"][0]

Running this code returns the following error

Traceback (most recent call last):
  File "C:\Users\hoge\stable-diffusion-dml-branch\dml_onnx.py", line 261, in <module>
    image = pipe(prompt, height=768, width=512, num_inference_steps=50, guidance_scale=7.5, eta=0.0, execution_provider="DmlExecutionProvider")["sample"][0]
  File "C:\Users\hoge\AppData\Roaming\Python\Python39\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\hoge\stable-diffusion-dml-branch\dml_onnx.py", line 171, in __call__
    noise_pred = unet_sess.run(None, inp)[0]
  File "C:\Users\hoge\AppData\Roaming\Python\Python39\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 200, in run
    return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: latent_model_input for the following indices
 index: 2 Got: 96 Expected: 64
 Please fix either the inputs or the model.

I think it conflicts with the setting of the example code in examples/inference/dml_onnx.py, but due to my lack of knowledge I cannot determine the cause.

Please let me know how to generate a 768x512 sized image with Stable Diffusion in this branch.

@zz1014449672
Copy link

https://www.youtube.com/watch?v=Z9PFh2Us3vk
This might help you.

@Patometro06
Copy link

You need to rebuild the data base to the proportion you want, but at more resolution you need more VRAM, see the steps to do it here #10 (works to higher sizes too)

PD: You need to calculate based in any divible number by 64, not by 8 as the comments in the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants