-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Alternative refiner implementation #12377
Conversation
SD Unet not working after switch the model , |
would you like to share specifics |
[08/07/2023-12:53:14] [TRT] [W] TensorRT was linked against cuDNN 8.9.0 but loaded cuDNN 8.7.0 from the log it not load the second TRT model the seconds model is SD my_mix46.safetensors |
pushed a possible solution |
Thank your so much can fix the first model not use SD Unet problem the second still cant ,and im try modify the code in 695 load_model(checkpoint_info, already_loaded_state_dict=state_dict) this code will force use of trt for inference, can fix my solution,but not a good idea for other user. after logActivating unet: [TRT] gf4 |
when we test again ,found before all return method ,need use sd_unet.apply_unet() in def reload_model_weights(sd_model=None, info=None): this method so im modify it like that def reload_model_weights_k(sd_model=None, info=None): |
There are a few problems I've found, and unfortunately this approach will need some modifications to get the best quality possible. First, comparing the results from this PR to what I was getting with #12328 (click the arrows on the left to show the images): This PR produces an image with less fine detail. This is because this PR still adds noise whereas mine does not. That said, if the noise is zeroed, the image is still not quite right: Looking further I found an off by 1 error in the denoising strength calculation: self.denoising_strength = 1.0 - stopped_at / self.steps
self.denoising_strength = 1.0 - (stopped_at + 1) / self.steps Unfortunately even with that change this is still not at the quality my PR had: So what is different from my PR? If I try this PR but prune the sigmas for the first pass by the number of steps early to stop: This PR without adding noise, with correct denoising strength, and pruning sigmas for the first passThe official SD XL repo also prunes sigmas, so that may be a requirement for this to work correctly. Unfortunately my testing for this approach was done also by pruning sigmas for the first pass to stop early and running the highres pass normally but without added noise. |
oh, you're right, you're right, adding noise is wrong, and not adding is wrong too, I need to recover the noisy image from the sampler rather than denoised one. |
Changed it to work with noisy latent from kdiffusion, and not add any noise. Looks fine for SDXL->SDXL and SD1->SD1, but pretty bad for SD1->SDXL. Maybe I'm doing something wrong, but if not we will have to revert to adding noise for SD1<->SDXL. |
the first can working, the second execution to the refiner reports an error: Detail Log:Reusing loaded model sd_xl_base_1.0.safetensors [31e35c80fc] to load sd_xl_refiner_1.0.safetensors [7440042bbd] |
@bosima AUTOMATIC1111/stable-diffusion-webui-tensorrt#58 |
I still believe we may have if a_is_sdxl != b_is_sdxl: I know that we probably do not want two behaviors, but after latest considerations of this pull request, we already seem to get two behaviors. But feel free to correct me if refreshing with img2img sampler is better than not for XL, but in my opinion, we should always preserve valuable history of sampler as long as we can |
I am experimenting these behaviors. https://github.com/lllyasviel/Stable-Diffusion-FixedUI |
Update OK my experiments finished:
|
Do you think it is a problem with implementation in this PR, or just with general concept? SD's official repo uses something like this. |
I think #12371 is better than re-initializing samplers. |
Besides,
Results are better when Also, XL vae decode + 1.5 vae encode tend to produce some slight ghost or color overflow problems, not sure why. |
Also, although not super recommended, it seems possible to add comfyui's git to |
that is not going to happen |
If you don't let the base image be noisy the refiner doesn't do much it seems, but it can actually do a lot of work. If you set the refiner up to 50% and let it work on a fuzzy base image, say 17 to 33 steps, it is much faster and makes nice images. The settings aren't right out of the box in the template. I also will suggest a tiled VAE. example images. This could help with your 1.5 / sdxl issues- |
Description
Refiner checkpoint
andRefiner switch at
.Refiner switch at
*total steps
steps, then switches model toRefiner checkpoint
, and then finishes sampling in img2img mode, using remaining number of steps and denoising strength equal to1
-Refiner switch at
.Refiner switch at
= 0.25, the first sampling will go for 5 steps and the second - for 15.