提交

38 次代码提交

作者 SHA1 备注 提交日期
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
Nikita Rossik 42889f6b2a Update documentation comments (#147) 2023-03-27 08:26:57 -07:00
Lucas Maciel 2c4e9de73c Fix: Missing a nil check at StableDiffusionCLI (#138) 0.3.0 2023-03-03 20:24:38 -08:00
Atila Orhon 827d017723 Update README with torchRNG guidance 2023-02-14 21:55:50 -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
Norton 00390a6418 fix (#125) 2023-02-09 20:07:18 -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
Joshua Park f0fc326477 Pass latent size args to unet and safety checker (#123) 2023-02-07 20:49:02 -08:00
Pedro Cuenca e4ca3ff86b Add link to HF app to the Example Swift App section. (#121) 2023-02-03 10:23:05 -08:00
Timothy Kautz 086cc5e04e Image2image - python (#115)
* Add Encoder model to torch2coreml for image2image

and later for in-paining

* diagonal test with randn

* Revert "diagonal test with randn"

This reverts commit 270afe1bb970c9413d3c3c9d09c0bd4f2dcbfa19.

* readme updates for encoder

* pr comments
0.2.0
2023-01-30 22:22:52 -08:00
Stephen 6cd5c7a760 Update import to nested path (#109)
* Update import to nested path

* Update python_coreml_stable_diffusion/unet.py

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

Co-authored-by: Atila Orhon <64497909+atiorh@users.noreply.github.com>
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2023-01-26 11:12:45 -08:00
Pedro Cuenca 3b24fe36a7 Fix downsample channels. (#110)
Reference: https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_blocks.py#L749-L756

This is usually not a problem for Stable Diffusion models. However, some
architectures such as
https://huggingface.co/OFA-Sys/small-stable-diffusion-v0 wouldn't
convert.
2023-01-26 11:10:58 -08:00
Kasima Tharnpipitchai fb1fa01c9d Add guidance scale flag for python CLI (#95) 2023-01-03 17:23:56 +03:00
Philipp c1fd82a96d Make negativePrompt optional in Swift CLI (#89) 2022-12-28 14:50:52 -08:00
Pedro Cuenca e3db2ec99e Fix timesteps of DPMSolverMultistepScheduler. (#88)
There were minor differences in the timesteps because the linspace was
computed slightly differently. This PR makes the Swift implementation
identical to the current Python implementation in diffusers, which was
originally contributed by the DPM-Solver++ author.

See
https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L199-L204
for reference.
2022-12-28 12:04:34 -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
Pedro Cuenca 877ccb9666 Add brief instructions to download weights from the Hub (#10)
* Add brief instructions to download weights from the Hub.

This should be convenient and time-saving for many users.

* Capitalize ORIGINAL.

* Expand git lfs details.

* Make download code robust to symlinks.

coremltools seems to not like symlinks.

* Add mention to demo app.

* Add steps to git lfs process.

* Minor text change.

* Apply suggestions from review.
2022-12-22 11:00:35 -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
Atila Orhon 37ff2a430f fixes #77 2022-12-19 20:59:41 -08:00
Yaroslav Spirin 66dde8da13 Update README.md (#66) 2022-12-15 16:23:41 -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
Christian Clauss d6a54fc2b0 Fix typos: Successfully facilitate getting pipeline overridden (#30) 2022-12-14 10:42:27 -08:00
Christian Clauss ec9fe68259 Undefined name: from typing import List (#31) 2022-12-14 10:38:07 -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 016d071321 Add pull request template 2022-12-13 18:58:41 -08:00
Atila Orhon 583cc04ece Initial commit
Co-authored-by: aseemw <aseem.elec@gmail.com>
Co-authored-by: msiracusa <msiracusa+github@gmail.com>
0.1.0
2022-11-30 13:41:05 -06:00