文件历史

19 次代码提交

作者 SHA1 备注 提交日期
Zach Nagengast c891f4357b Add SD3 Pipeline (#329)
* Add SD3 Pipeline

Co-authored-by: atiorh <atiorh@users.noreply.github.com>
Co-authored-by: arda-argmax <arda-argmax@users.noreply.github.com>

* Use swift-transformers for tokenization

* Use diffusionkit converters in torch2coreml

* Documentation and cleanup

* Add model link

* Consolidate batch prediction logic

* Remove DecoderSD3.swift and consolidate logic into Decoder.swift

* Remove DiffusionKit MLX inference reference from README

---------

Co-authored-by: atiorh <atiorh@users.noreply.github.com>
Co-authored-by: arda-argmax <arda-argmax@users.noreply.github.com>
Co-authored-by: atila <atiorh@icloud.com>
2024-07-22 21:16:50 -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
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
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 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 7f9c58a6c1 WWDC23 update
Co-authored-by: davidfindlay1 <david.arthur.findlay@icloud.com>
2023-06-14 08:27:02 -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
Lucas Maciel 2c4e9de73c Fix: Missing a nil check at StableDiffusionCLI (#138) 2023-03-03 20:24:38 -08:00
Liu Liu ddefb61673 Add random source that matches PyTorch (#124)
* Add random source that matches PyTorch

This added random source that matches PyTorch on CPU. In particular, it
matches: `torch.randn([], dtype=torch.float)` result.

PyTorch's RNG is a bit convoluted and not claimed to be version-stable
(will open a separate issue in PyTorch repo on this). However, the
current implementation on CPU is fairly straightforward^*.

1. If it is less than 16 elements, it uses Gaussian distribution sampled
   from MT19937 for double + Box-Muller transformation.

2. If it is more than 16 (16 included), it first do uniform sampling
   with whatever the resulting data type would be (in this case, torch.float),
   and then apply Box-Muller transformation over 16-element segment at a
   type, treating the first floating-point and the 8th as a pair, so on
   so forth.

3. If it is not a multiple of 16, trace back from the end for 16
   elements and redo step 2.

* Update with configuration available in SwiftDiffusionCLI

* Fix the RNG is not passed into pipelineConfig.
2023-02-14 21:45:27 -08:00
Timothy Kautz fa7bbdc255 Image2image - swift (#116)
* Image2Image Encoder

Encoder

* Scheduler and pipeline

* fix scheduler

* cli

* remove CLI comment

* disable dpm multistep solver with image2image

* clamp initial timestamp

* Store timesteps in reverse order for consistency.

* Report actual number of steps.

* uint32

* PRComments

* remove old initializer

* pr comments

* change name and add error handling

also fix 512 hard coded

* Add fix for Jpegs

---------

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2023-02-09 10:30:21 -08:00
Philipp c1fd82a96d Make negativePrompt optional in Swift CLI (#89) 2022-12-28 14:50:52 -08:00
Wanaldino Antimonio e07c4d00c3 Move guidanceScale as generation parameter (#46)
* Move guidanceScale as generation parameter

* Added guidanceScale in CLI

* Reverted identation change
2022-12-24 10:33:39 -08:00
JustinMeans c90b705334 Adds Negative Prompts (#61)
* Synced to main branch and minimizes line changes

* Adds negative prompt argument to CLI

Co-authored-by: Wanaldino Antimonio <carlosmm31093@gmail.com>
2022-12-20 22:57:34 -08:00
Wanaldino Antimonio 4c00b32010 Changed seed type into UInt32 (#47) 2022-12-20 14:34:53 -08:00
dec2-anon 21f504fc8e Add Filename Character Limit (#19)
Co-authored-by: Stefan-Hintz <github@corbusierhaus.de>
2022-12-15 07:17:00 -08:00
Pedro Cuenca 3758abc652 Implement DPM-Solver++ scheduler (#59) 2022-12-14 18:05:30 -08:00
Nathan Tannar 152dd65e7d Add Availability Annotations (#18) 2022-12-14 10:23:55 -08:00
Atila Orhon a4238a3718 README improvements and reduceMemory option in Swift
Co-authored-by: msiracusa <msiracusa+github@gmail.com>
2022-12-14 08:23:55 -08:00
Atila Orhon 583cc04ece Initial commit
Co-authored-by: aseemw <aseem.elec@gmail.com>
Co-authored-by: msiracusa <msiracusa+github@gmail.com>
2022-11-30 13:41:05 -06:00