提交

78 次代码提交

作者 SHA1 备注 提交日期
Atila Orhon 081a8cb2cc v1.1 1.1.0 2023-09-28 07:26:41 -07:00
Pedro Cuenca 94814cfa41 Sigma and timestep spacing configuration for DPMSolverMultistepScheduler (#265)
* `leading` timestep spacing for DPMSolverMultistepScheduler

* Karras sigmas and timesteps

* Make sigmas/timesteps externally configurable
2023-09-27 09:35:39 -07:00
Atila Orhon d0d05ce44d Fix compute unit for chunk_mlprogram parity checks 2023-09-26 13:21:15 -07:00
Hector Lopez Hernandez, PhD f3a212491c Xl python inference (#261)
* Updated pipeline.py for XL inference

* cleaned up

* Add shape handling for UNET time_ids shape

* added support for loading from CompiledMLModel
2023-09-26 13:12:07 -07:00
Zach Nagengast 94dfc6b548 Support for SDXL refiner (#227)
* Initial support for SDXL refiner

* Cleanup

* Add arg for converting Unet in float32 precision

* Setup scale factor with pipeline in CLI

* Update cli arg and future warning

* Bundle refiner unet if specified

* Update script for bundled refiner

- Also skip loading model if check_output_correctness is missing, since the model does not require inferencing at conversion time

* Flip skip_model_load bool

* Cleanup

* Support bundled UnetRefiner

* Add seperate refiner config value

- Includes unloading base unet when swapping to refiner

* Update readme for SDXL refiner

* Add condition for new SDXL coreml input features

* Revert pipeline interface change, add extra logging on pipe load

* Reset model_version after refiner conversion

* Reset model_version before refiner conversion but after pipe init

* Add refiner chunking

* Ensure unets are unloaded for reduceMemory true

* Handle missing UnetRefiner.mlmodelc on pipeline load

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Prewarm refiner on load, unload on complete

* Force cpu_and_gpu for VAE until it can be fixed

* Include output dtype of np.float32 for all conversions

* Allow a custom VAE to be converted.

* Revert hardcoded reduceMemory

* Fix merge

* Default chunking arg for --merge-chunks-in-pipeline-model when called from torch2coreml

---------

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2023-09-26 13:09:58 -07:00
Atila Orhon d22986190b Support pipeline model creation for chunks 2023-09-23 09:24:59 -07:00
Atila Orhon e3c1e36e18 SDXL refiner mixed-bit palettization pre-analysis 2023-09-23 09:24:59 -07:00
Toby Roseman cf4afe150b Fix boundary var issue when chunking model with coremltools 7.0 (#259) 2023-09-20 14:01:19 -07:00
Liu Liu 7b59c2b663 Add NvRandomSource (#257)
Draw Things 1.20230913.1 released with NVIDIA GPU Compatible mode. See
example: https://twitter.com/drawthingsapp/status/1702387783166476689

This is the implementation that should be compatible with the
ml-stable-diffusion project.
2023-09-14 16:34:29 -07:00
Ryu-ga c5063225aa Update Decoder.swift (#249)
* Update Decoder.swift

* Update Encoder.swift

---------

Co-authored-by: Ryu-ga <frech5679@icloud.com>
2023-09-01 11:50:01 -07:00
Atila Orhon a56e10232d Fixes #243
Co-authored-by: TBPer <thanawat.boonmee@gmail.com>
2023-08-30 14:02:20 -07:00
Atila Orhon ebff5f7402 fixes #246 2023-08-29 06:43:07 -07:00
Aseem Wadhwa 35613e5d34 update chunking script to work with models that contains compressed weights, i.e. constexpr* ops (#245) 2023-08-29 04:57:30 -07:00
Atila Orhon 40ff5f5f1f fixes #244 2023-08-28 10:51:47 -07:00
Pedro Cuenca 80c0551419 CGImage to shaped array fix (#239)
* Take row padding into account.

* Rename symbols for clarity.
2023-08-26 23:51:58 -07:00
Pedro Cuenca df1c41c373 Upgrade coremltools, transformers; remove attn workaround (#241) 2023-08-24 22:17:44 +03:00
Pedro Cuenca 27df66021d Remove mlpackage save workaround. (#240)
https://github.com/apple/coremltools/issues/1680 has been resolved in
coremltools 7.0b1, which is now required. The reason for addressing this
change now is that reloading the model before save may incur a
performance cost (specially on SDXL models) due to `ANECompilerService`
triggering and executing for a long time.
2023-08-24 22:16:28 +03:00
Thibault Castells dc8deb3b1e Fix multiple issues in mixed bit compression pre analysis (#231)
* fix multiple issues in mixed bit compression pre analysis: wrong dtype, cannot change default nbits and ImportError

* fixed dtype issue in fake_palettize function

---------

Co-authored-by: Thibault <thibault@Thibaults-Mac-mini.local>
2023-08-22 00:00:22 +03:00
Mustafa Ateş Uzun 599bd577ed fix: read.md word spelling (#234) 2023-08-20 23:56:23 +03:00
Zach Nagengast b392a0aca0 Use denoised latent for final decoder (#230)
* Send denoised latent to final decoder

- Previously it was sending the noisy latent from the last timestep

* Include fix for no-xl pipeline
2023-08-08 10:47:42 -07:00
Atila Orhon ce8ee78e28 Fix SDXL vae scale factor
Co-authored-by: Liu Liu <i@liuliu.me>
Co-authored-by: Brad Herman <brad.herman@gmail.com>
2023-08-06 01:39:23 -07:00
Atila Orhon 7e106460e3 fix import 2023-08-02 20:30:45 -10:00
Atila Orhon 8cf34376f9 SDXL and other improvements
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Co-authored-by: Zach Nagengast <zacharynagengast@gmail.com>
2023-07-27 09:08:30 -10:00
Atila Orhon a57d127606 Mixed-bit Palettization
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2023-07-27 09:07:44 -10:00
Atila Orhon f741511ef2 import Accelerate 2023-07-19 20:56:57 -07:00
JustinMeans b8b5e886df Update ControlNet.swift (#214)
Speed up multi-control net by implementing Accelerate vectorized routines.
2023-07-18 09:34:25 -07:00
Zach Nagengast b61c9aea05 Support for denoised latent images on progress updates (#210)
* Use denoised latents for currentLatentSamples

* Remove incorrect scheduler reference

* Add denoise option to preserve original functionality
2023-07-14 15:52:13 -07:00
Zsolt Váradi db13060fec Restore compatibility with Xcode 14.3/macOS SDK 13.4 (#208) 2023-07-12 11:49:22 -07:00
Zsolt Váradi 823d21ecf4 Extend ControlNet image conversion with hole punching for InPaint (#205)
* Extend ControlNet image conversion with hole punching for InPaint

The inpainting ControlNet model expects the masked areas to be filled with -1. This never occured with the original conversion, as the pixel data was converted to values between [0;1], thus the inpainting CN model never had any effect (apart from maybe generating artifacts).

This commit uses the _previously discarded_ alpha channel of the source image to mark masked pixels: any non-opaque pixel is cleared out to -1.
For an end-user, this allows creating masks simply by erasing areas with Preview to transparent, saving the result as PNG, and feeding it to the ControlNet.

* Mask only fully transparent pixels
2023-07-09 21:11:26 -07:00
Pedro Cuenca 48f07f2489 Links to quantized models in the Hugging Face hub. (#193) 2023-06-14 09:03:59 -07:00
Atila Orhon 7f9c58a6c1 WWDC23 update
Co-authored-by: davidfindlay1 <david.arthur.findlay@icloud.com>
1.0.0
2023-06-14 08:27:02 -07:00
Zsolt Váradi e3875a584b Add device parameter to overridden _build_causal_attention_mask (#184) 2023-05-16 21:17:44 +09:00
Oleg Ponomaryov ea904e31d7 Image encoder resources management fix (#182)
* Unload image encoder for image2image in reduceMemory mode

* Include image encoder to resource management functions
2023-05-06 21:22:19 -07:00
Alejandro Isaza 940dba02ee Require Swift 5.8 (#179) 2023-05-01 10:18:09 -07:00
Atila Orhon 8fd725764f Fixes #178 2023-05-01 09:52:58 -07:00
Atila Orhon efea9d3812 Fix encoder sdpa disable 2023-04-29 22:07:27 -07:00
Atila Orhon ef5aa89c45 Disable SDPA for vae_encoder 2023-04-28 21:15:57 -07:00
Pedro Cuenca 449a16d96e Disable SDPA (PyTorch 2.0) in the VAE (#174)
* Disable SDPA (PyTorch 2.0) in the VAE

Diffusers 0.16.0 made sdpa enabled by default in the vae. It had
previously been enabled for the UNet, but it didn't affect this repo
because it uses its own copy of the UNet.

This fix will not work for diffusers 0.16.0, but it will for main or
0.16.1 (to be released today).

* Link to coremltools issue.
2023-04-28 21:14:25 -07:00
Pedro Cuenca 41174b937b Minor: make --help work. (#175) 2023-04-28 21:13:36 -07:00
Pedro Cuenca 4aafa737ba Verify ControlNet base model. (#172)
We currently display a warning if the ControlNet repo does not contain a
`base_model` property and the `model-version` is not SD 1.5.

If the ControlNet repo does indicate a `base_model` property, then we
raise a hard error if the versions don't match.
2023-04-27 15:53:10 -07:00
Alejandro Isaza a7bf219247 Improve BPETokenizer.readMerges performance (#169)
From 240ms to 19ms on M1 MacBook Pro

Co-authored-by: Alejandro Isaza <aisaza@apple.com>
0.4.0
2023-04-26 21:51:25 -07:00
Zsolt Váradi fbef6c3826 Fix img2img starting image shape (#168) 2023-04-26 13:01:45 -07:00
Alejandro Isaza 28a29312fd Scheduler performance optimizations in Swift 2023-04-26 08:25:16 -07:00
Atila Orhon 412c679d25 Fixes #160 2023-04-24 12:13:30 -07:00
Atila Orhon ce0be82717 Fixes #165 2023-04-23 21:17:59 -07:00
Atila Orhon 5d2744e382 Add ControlNet example 2023-04-18 16:52:52 -07:00
Chimme 7f65e1c84b Support ControlNet (#153)
* add controlnet tentatively

* add controlnet in python code

* implement swift part

* support 8-bit quantization

* add controlnet unload when reduce memory

* remove irrelevant changes

* add more description about controlnet option in swift

* fix some for pr and update README

* pre-allocate zero shapedArray + make multi-controlnet faster
2023-04-18 16:17:59 -07:00
Atila Orhon d1a6888d43 fixes #155 2023-04-13 08:56:20 -07:00
Atila Orhon ab12eee10c [swift] Added scaleFactor explanation 2023-04-03 12:37:13 -07:00
Guillermo Cique 1147e87b79 Simplify Encoder module (#145)
* Simplify encoder conversion

* Add nextNormal to RandomSource

* Add addNoise method to Scheduler

* Update Encoder implementation

* Clean up Pipeline

* Remove AlphasCumprodCalculation

* Revert Encoder’s input shape size

* Make Encoder/Decoder's scale factor configurable
2023-04-03 12:31:53 -07:00