文件历史

21 次代码提交

作者 SHA1 备注 提交日期
Atila Orhon 7f9c58a6c1 WWDC23 update
Co-authored-by: davidfindlay1 <david.arthur.findlay@icloud.com>
2023-06-14 08:27:02 -07: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 a7bf219247 Improve BPETokenizer.readMerges performance (#169)
From 240ms to 19ms on M1 MacBook Pro

Co-authored-by: Alejandro Isaza <aisaza@apple.com>
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
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 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
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
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
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
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
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