-
Notifications
You must be signed in to change notification settings - Fork 0
[WIP] Add Unet for consistency models #1
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
[WIP] Add Unet for consistency models #1
Conversation
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
* add stable diffusion tensorrt img2img pipeline Signed-off-by: Asfiya Baig <asfiyab@nvidia.com> * update docstrings Signed-off-by: Asfiya Baig <asfiyab@nvidia.com> --------- Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>
* refactor controlnet and add img2img and inpaint * First draft to get pipelines to work * make style * Fix more * Fix more * More tests * Fix more * Make inpainting work * make style and more tests * Apply suggestions from code review * up * make style * Fix imports * Fix more * Fix more * Improve examples * add test * Make sure import is correctly deprecated * Make sure everything works in compile mode * make sure authorship is correctly attributed
* Add DPM-Solver Multistep Inverse Scheduler * Add draft tests for DiffEdit * Add inverse sde-dpmsolver steps to tune image diversity from inverted latents * Fix tests --------- Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Fix incomplete docstrings for resnet.py
fix tiled vae bleand extent range
Small update to "Next steps" section: - PyTorch 2 is recommended. - Updated improvement figures.
…e#3298) * Update pipeline_if_superresolution.py Allow arbitrary aspect ratio in IFSuperResolutionPipeline by using the input image shape * IFSuperResolutionPipeline: allow the user to override the height and width through the arguments * update IFSuperResolutionPipeline width/height doc string to match StableDiffusionInpaintPipeline conventions --------- Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
…gingface#3424) * Added explanation of 'strength' parameter * Added get_timesteps function which relies on new strength parameter * Added `strength` parameter which defaults to 1. * Swapped ordering so `noise_timestep` can be calculated before masking the image this is required when you aren't applying 100% noise to the masked region, e.g. strength < 1. * Added strength to check_inputs, throws error if out of range * Changed `prepare_latents` to initialise latents w.r.t strength inspired from the stable diffusion img2img pipeline, init latents are initialised by converting the init image into a VAE latent and adding noise (based upon the strength parameter passed in), e.g. random when strength = 1, or the init image at strength = 0. * WIP: Added a unit test for the new strength parameter in the StableDiffusionInpaintingPipeline still need to add correct regression values * Created a is_strength_max to initialise from pure random noise * Updated unit tests w.r.t new strength parameter + fixed new strength unit test * renamed parameter to avoid confusion with variable of same name * Updated regression values for new strength test - now passes * removed 'copied from' comment as this method is now different and divergent from the cpy * Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> * Ensure backwards compatibility for prepare_mask_and_masked_image created a return_image boolean and initialised to false * Ensure backwards compatibility for prepare_latents * Fixed copy check typo * Fixes w.r.t backward compibility changes * make style * keep function argument ordering same for backwards compatibility in callees with copied from statements * make fix-copies --------- Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> Co-authored-by: William Berman <WLBberman@gmail.com>
…s partially downloaded (huggingface#3448) Added bugfix using f strings.
…grad=False) (huggingface#3404) * gradient checkpointing bug fix * bug fix; changes for reviews * reformat * reformat --------- Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
* Make dreambooth lora more robust to orig unet * up
…y're unnecessary) (huggingface#3463) Release large tensors in attention (as soon as they're no longer required). Reduces peak VRAM by nearly 2 GB for 1024x1024 (even after slicing), and the savings scale up with image size.
add min snr to text2img lora training script
* add inpaint lora scale support * add inpaint lora scale test --------- Co-authored-by: yueyang.hyy <yueyang.hyy@alibaba-inc.com>
* Correct from_ckpt * make style
* dreambooth docs torch.compile note * Update examples/dreambooth/README.md Co-authored-by: Sayak Paul <spsayakpaul@gmail.com> * Update examples/dreambooth/README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com> Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
* add textual inversion inference to docs * add to toctree --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* distributed inference * move to inference section * apply feedback * update with split_between_processes * apply feedback
…lattened indices (huggingface#3479) explicit view kernel size as number elements in flattened indices
* Remove ONNX tests from PR. They are already a part of push_tests.yml. * Remove mps tests from PRs. They are already performed on push. * Fix workflow name for fast push tests. * Extract mps tests to a workflow. For better control/filtering. * Remove --extra-index-url from mps tests * Increase tolerance of mps test This test passes in my Mac (Ventura 13.3) but fails in the CI hardware (Ventura 13.2). I ran the local tests following the same steps that exist in the CI workflow. * Temporarily run mps tests on pr So we can test. * Revert "Temporarily run mps tests on pr" Tests passed, go back to running on push.
…ocessor2_0` (huggingface#3457) * add: debugging to enabling memory efficient processing * add: better warning message.
add note on local directory path. Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
|
@dg845 Was able to convert the Unet into diffusers, load pretrained checkpoints and get same outputs from forward passes: ckpt : https://huggingface.co/ayushtues/consistency_models/tree/main
|
|
Had to add two new blocks to Open to suggestions on how to design this better |
|
The documentation is not available anymore as the PR was closed or merged. |
|
Sorry, didn't get a chance to look at this until now.
The new blocks look fine to me. I guess I'm not the most knowledgeable about unet_2d_blocks so it might be worth it to ask the maintainers directly about the design. Also, I have a quick question: does the conversion script support class-conditional models? I see for example in the consistency model scripts that there are some examples of training and sampling from them. |
|
I took a closer look at the unet block implementations and it looks like |
|
Sorry, I was blocked by Github for a while ( supposedly a VS code extension was generating infinite PRs 🙈 ).
The current |
These blocks use Also the new blocks are simply a copy of So we can also instead parameterize |
|
Makes sense, looks good to me then :). |
* Implement `CustomDiffusionAttnProcessor2_0` * Doc-strings and type annotations for `CustomDiffusionAttnProcessor2_0`. (#1) * Update attnprocessor.md * Update attention_processor.py * Interops for `CustomDiffusionAttnProcessor2_0`. * Formatted `attention_processor.py`. * Formatted doc-string in `attention_processor.py` * Conditional CustomDiffusion2_0 for training example. * Remove unnecessary reference impl in comments. * Fix `save_attn_procs`.
Adding Unet model and conversion scripts, part of huggingface#3492
To-do