1. 22 May, 2023 1 commit
    • Patrick von Platen's avatar
      Refactor full determinism (#3485) · 51843fd7
      Patrick von Platen authored
      * up
      
      * fix more
      
      * Apply suggestions from code review
      
      * fix more
      
      * fix more
      
      * Check it
      
      * Remove 16:8
      
      * fix more
      
      * fix more
      
      * fix more
      
      * up
      
      * up
      
      * Test only stable diffusion
      
      * Test only two files
      
      * up
      
      * Try out spinning up processes that can be killed
      
      * up
      
      * Apply suggestions from code review
      
      * up
      
      * up
      51843fd7
  2. 20 May, 2023 1 commit
    • Pedro Cuenca's avatar
      mps & onnx tests rework (#3449) · f7b4f51c
      Pedro Cuenca authored
      * 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.
      f7b4f51c
  3. 18 May, 2023 2 commits
  4. 17 May, 2023 2 commits
    • Glaceon-Hyy's avatar
      Add inpaint lora scale support (#3460) · 88295f92
      Glaceon-Hyy authored
      
      
      * add inpaint lora scale support
      
      * add inpaint lora scale test
      
      ---------
      Co-authored-by: default avataryueyang.hyy <yueyang.hyy@alibaba-inc.com>
      88295f92
    • Rupert Menneer's avatar
      Adding 'strength' parameter to StableDiffusionInpaintingPipeline (#3424) · c09c4f3a
      Rupert Menneer authored
      
      
      * 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: default avatarPatrick 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: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarWilliam Berman <WLBberman@gmail.com>
      c09c4f3a
  5. 16 May, 2023 2 commits
    • clarencechen's avatar
      [Scheduler] DPM-Solver (++) Inverse Scheduler (#3335) · 17f9aed7
      clarencechen authored
      
      
      * 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: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      17f9aed7
    • Patrick von Platen's avatar
      Refactor controlnet and add img2img and inpaint (#3386) · 886575ee
      Patrick von Platen authored
      * 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
      886575ee
  6. 12 May, 2023 1 commit
  7. 11 May, 2023 2 commits
    • Sayak Paul's avatar
      [Tests] better determinism (#3374) · 90f5f3c4
      Sayak Paul authored
      * enable deterministic pytorch and cuda operations.
      
      * disable manual seeding.
      
      * make style && make quality for unet_2d tests.
      
      * enable determinism for the unet2dconditional model.
      
      * add CUBLAS_WORKSPACE_CONFIG for better reproducibility.
      
      * relax tolerance (very weird issue, though).
      
      * revert to torch manual_seed() where needed.
      
      * relax more tolerance.
      
      * better placement of the cuda variable and relax more tolerance.
      
      * enable determinism for 3d condition model.
      
      * relax tolerance.
      
      * add: determinism to alt_diffusion.
      
      * relax tolerance for alt diffusion.
      
      * dance diffusion.
      
      * dance diffusion is flaky.
      
      * test_dict_tuple_outputs_equivalent edit.
      
      * fix two more tests.
      
      * fix more ddim tests.
      
      * fix: argument.
      
      * change to diff in place of difference.
      
      * fix: test_save_load call.
      
      * test_save_load_float16 call.
      
      * fix: expected_max_diff
      
      * fix: paint by example.
      
      * relax tolerance.
      
      * add determinism to 1d unet model.
      
      * torch 2.0 regressions seem to be brutal
      
      * determinism to vae.
      
      * add reason to skipping.
      
      * up tolerance.
      
      * determinism to vq.
      
      * determinism to cuda.
      
      * determinism to the generic test pipeline file.
      
      * refactor general pipelines testing a bit.
      
      * determinism to alt diffusion i2i
      
      * up tolerance for alt diff i2i and audio diff
      
      * up tolerance.
      
      * determinism to audioldm
      
      * increase tolerance for audioldm lms.
      
      * increase tolerance for paint by paint.
      
      * increase tolerance for repaint.
      
      * determinism to cycle diffusion and sd 1.
      
      * relax tol for cycle diffusion 🚲
      
      * relax tol for sd 1.0
      
      * relax tol for controlnet.
      
      * determinism to img var.
      
      * relax tol for img variation.
      
      * tolerance to i2i sd
      
      * make style
      
      * determinism to inpaint.
      
      * relax tolerance for inpaiting.
      
      * determinism for inpainting legacy
      
      * relax tolerance.
      
      * determinism to instruct pix2pix
      
      * determinism to model editing.
      
      * model editing tolerance.
      
      * panorama determinism
      
      * determinism to pix2pix zero.
      
      * determinism to sag.
      
      * sd 2. determinism
      
      * sd. tolerance
      
      * disallow tf32 matmul.
      
      * relax tolerance is all you need.
      
      * make style and determinism to sd 2 depth
      
      * relax tolerance for depth.
      
      * tolerance to diffedit.
      
      * tolerance to sd 2 inpaint.
      
      * up tolerance.
      
      * determinism in upscaling.
      
      * tolerance in upscaler.
      
      * more tolerance relaxation.
      
      * determinism to v pred.
      
      * up tol for v_pred
      
      * unclip determinism
      
      * determinism to unclip img2img
      
      * determinism to text to video.
      
      * determinism to last set of tests
      
      * up tol.
      
      * vq cumsum doesn't have a deterministic kernel
      
      * relax tol
      
      * relax tol
      90f5f3c4
    • Takuma Mori's avatar
      Support ControlNet v1.1 shuffle properly (#3340) · 01c056f0
      Takuma Mori authored
      
      
      * add inferring_controlnet_cond_batch
      
      * Revert "add inferring_controlnet_cond_batch"
      
      This reverts commit abe8d6311d4b7f5b9409ca709c7fabf80d06c1a9.
      
      * set guess_mode to True
      whenever global_pool_conditions is True
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * nit
      
      * add integration test
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      01c056f0
  8. 10 May, 2023 2 commits
    • Patrick von Platen's avatar
      make style · 82e6fa56
      Patrick von Platen authored
      82e6fa56
    • Rupert Menneer's avatar
      StableDiffusionInpaintingPipeline - resize image w.r.t height and width (#3322) · edb087a2
      Rupert Menneer authored
      
      
      * StableDiffusionInpaintingPipeline now resizes input images and masks w.r.t to passed input height and width. Default is already set to 512. This addresses the common tensor mismatch error. Also moved type check into relevant funciton to keep main pipeline body tidy.
      
      * Fixed StableDiffusionInpaintingPrepareMaskAndMaskedImageTests
      
      Due to previous commit these tests were failing as height and width need to be passed into the prepare_mask_and_masked_image function, I have updated the code and added a height/width variable per unit test as it seemed more appropriate than the current hard coded solution
      
      * Added a resolution test to StableDiffusionInpaintPipelineSlowTests
      
      this unit test simply gets the input and resizes it into some that would fail (e.g. would throw a tensor mismatch error/not a mult of 8). Then passes it through the pipeline and verifies it produces output with correct dims w.r.t the passed height and width
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      edb087a2
  9. 09 May, 2023 1 commit
  10. 08 May, 2023 1 commit
    • pdoane's avatar
      Batched load of textual inversions (#3277) · 3d8b3d7c
      pdoane authored
      
      
      * Batched load of textual inversions
      
      - Only call resize_token_embeddings once per batch as it is the most expensive operation
      - Allow pretrained_model_name_or_path and token to be an optional list
      - Remove Dict from type annotation pretrained_model_name_or_path as it was not supported in this function
      - Add comment that single files (e.g. .pt/.safetensors) are supported
      - Add comment for token parameter
      - Convert token override log message from warning to info
      
      * Update src/diffusers/loaders.py
      
      Check for duplicate tokens
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * Update condition for None tokens
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      3d8b3d7c
  11. 06 May, 2023 2 commits
  12. 05 May, 2023 1 commit
  13. 03 May, 2023 1 commit
  14. 02 May, 2023 1 commit
  15. 01 May, 2023 2 commits
  16. 28 Apr, 2023 2 commits
    • Will Berman's avatar
      temp disable spectogram diffusion tests (#3278) · 384c83aa
      Will Berman authored
      The note-seq package throws an error on import because the default installed version of Ipython
      is not compatible with python 3.8 which we run in the CI.
      https://github.com/huggingface/diffusers/actions/runs/4830121056/jobs/8605954838#step:7:9
      384c83aa
    • clarencechen's avatar
      Diffedit Zero-Shot Inpainting Pipeline (#2837) · be0bfcec
      clarencechen authored
      * Update Pix2PixZero Auto-correlation Loss
      
      * Add Stable Diffusion DiffEdit pipeline
      
      * Add draft documentation and import code
      
      * Bugfixes and refactoring
      
      * Add option to not decode latents in the inversion process
      
      * Harmonize preprocessing
      
      * Revert "Update Pix2PixZero Auto-correlation Loss"
      
      This reverts commit b218062fed08d6cc164206d6cb852b2b7b00847a.
      
      * Update annotations
      
      * rename `compute_mask` to `generate_mask`
      
      * Update documentation
      
      * Update docs
      
      * Update Docs
      
      * Fix copy
      
      * Change shape of output latents to batch first
      
      * Update docs
      
      * Add first draft for tests
      
      * Bugfix and update tests
      
      * Add `cross_attention_kwargs` support for all pipeline methods
      
      * Fix Copies
      
      * Add support for PIL image latents
      
      Add support for mask broadcasting
      
      Update docs and tests
      
      Align `mask` argument to `mask_image`
      
      Remove height and width arguments
      
      * Enable MPS Tests
      
      * Move example docstrings
      
      * Fix test
      
      * Fix test
      
      * fix pipeline inheritance
      
      * Harmonize `prepare_image_latents` with StableDiffusionPix2PixZeroPipeline
      
      * Register modules set to `None` in config for `test_save_load_optional_components`
      
      * Move fixed logic to specific test class
      
      * Clean changes to other pipelines
      
      * Update new tests to coordinate with #2953
      
      * Update slow tests for better results
      
      * Safety to avoid potential problems with torch.inference_mode
      
      * Add reference in SD Pipeline Overview
      
      * Fix tests again
      
      * Enforce determinism in noise for generate_mask
      
      * Fix copies
      
      * Widen test tolerance for fp16 based on `test_stable_diffusion_upscale_pipeline_fp16`
      
      * Add LoraLoaderMixin and update `prepare_image_latents`
      
      * clean up repeat and reg
      
      * bugfix
      
      * Remove invalid args from docs
      
      Suppress spurious warning by repeating image before latent to mask gen
      be0bfcec
  17. 27 Apr, 2023 3 commits
  18. 26 Apr, 2023 1 commit
  19. 25 Apr, 2023 2 commits
    • Patrick von Platen's avatar
      add model (#3230) · e51f19ae
      Patrick von Platen authored
      
      
      * add
      
      * clean
      
      * up
      
      * clean up more
      
      * fix more tests
      
      * Improve docs further
      
      * improve
      
      * more fixes docs
      
      * Improve docs more
      
      * Update src/diffusers/models/unet_2d_condition.py
      
      * fix
      
      * up
      
      * update doc links
      
      * make fix-copies
      
      * add safety checker and watermarker to stage 3 doc page code snippets
      
      * speed optimizations docs
      
      * memory optimization docs
      
      * make style
      
      * add watermarking snippets to doc string examples
      
      * make style
      
      * use pt_to_pil helper functions in doc strings
      
      * skip mps tests
      
      * Improve safety
      
      * make style
      
      * new logic
      
      * fix
      
      * fix bad onnx design
      
      * make new stable diffusion upscale pipeline model arguments optional
      
      * define has_nsfw_concept when non-pil output type
      
      * lowercase linked to notebook name
      
      ---------
      Co-authored-by: default avatarWilliam Berman <WLBberman@gmail.com>
      e51f19ae
    • pdoane's avatar
      Fix issue in maybe_convert_prompt (#3188) · 0d196f9f
      pdoane authored
      When the token used for textual inversion does not have any special symbols (e.g. it is not surrounded by <>), the tokenizer does not properly split the replacement tokens.  Adding a space for the padding tokens fixes this.
      0d196f9f
  20. 22 Apr, 2023 1 commit
  21. 21 Apr, 2023 1 commit
  22. 20 Apr, 2023 3 commits
  23. 19 Apr, 2023 2 commits
    • hwuebben's avatar
      Update pipeline_stable_diffusion_inpaint_legacy.py (#2903) · 3becd368
      hwuebben authored
      
      
      * Update pipeline_stable_diffusion_inpaint_legacy.py
      
      * fix preprocessing of Pil images with adequate batch size
      
      * revert map
      
      * add tests
      
      * reformat
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * next try to fix the style
      
      * wth is this
      
      * Update testing_utils.py
      
      * Update testing_utils.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      * Update test_stable_diffusion_inpaint_legacy.py
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      3becd368
    • 1lint's avatar
      add from_ckpt method as Mixin (#2318) · 86ecd4b7
      1lint authored
      
      
      * add mixin class for pipeline from original sd ckpt
      
      * Improve
      
      * make style
      
      * merge main into
      
      * Improve more
      
      * fix more
      
      * up
      
      * Apply suggestions from code review
      
      * finish docs
      
      * rename
      
      * make style
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      86ecd4b7
  24. 18 Apr, 2023 1 commit
  25. 17 Apr, 2023 2 commits