-
Notifications
You must be signed in to change notification settings - Fork 118
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
When height and width change, the inference speed will significantly slow down. #423
Comments
Which script are you using? |
It seems that xdit requires the resolution used in prepare_run to be the same as the resolution in the actual call. If prepare_run uses 1152x1152, but the actual call uses 1056x1056, it will be very slow. |
@feifeibear
output = pipe(
height=1152,
width=1152,
prompt=input_config.prompt,
num_inference_steps=input_config.num_inference_steps,
output_type=input_config.output_type,
max_sequence_length=256,
guidance_scale=0.0,
generator=torch.Generator(device="cuda").manual_seed(input_config.seed),
) It taken 5s. If we modify output = pipe(
height=1056,
width=1056,
prompt=input_config.prompt,
num_inference_steps=input_config.num_inference_steps,
output_type=input_config.output_type,
max_sequence_length=256,
guidance_scale=0.0,
generator=torch.Generator(device="cuda").manual_seed(input_config.seed),
) It taken 20s. |
I see, you did not prepare run the correct image used for inference. You can run multiple inference and see if it still slow after the first run. |
@feifeibear Thanks for your response. |
Have you used the torch compile option? |
yes |
@feifeibear How to deal with the problem of frequent resolution changes? Not use torch compile option? |
dynamic shape of torch.compile is a well-known challenge. We will investigate the problem and see if we can find some good solutions. Tell us if you find some good ideas. |
Whenever height / width change,
pipe.prepare_run
needs to be re-executed, which is very time-consuming. Is there a better approach?The text was updated successfully, but these errors were encountered: