1
0
Fork 0
Commit Graph

723 Commits

Author SHA1 Message Date
Sean Sube 539d0febce
load extras during server init 2023-03-05 07:20:37 -06:00
Sean Sube 537c67619e
fix strings endpoint 2023-03-05 07:20:34 -06:00
Sean Sube 5d459ab17c
feat: allow users to add their own labels for models (#144) 2023-03-05 07:20:31 -06:00
Sean Sube 628812fb0b
fix(api): correct conversion imports 2023-03-04 23:03:15 -06:00
Sean Sube 43d4d4b86d
chore(api): dedupe model listing logic 2023-03-04 22:26:27 -06:00
Sean Sube 10fbafaff0
fix(api): correct imports 2023-03-04 22:25:49 -06:00
Sean Sube 7b88371832
lint(api): use load pattern in server submodule 2023-03-04 22:13:09 -06:00
Sean Sube bb1d945761
lint(api): submodules for major libs 2023-03-04 22:12:35 -06:00
Sean Sube 39d36618e6
feat(api): add support for custom tokens for textual inversions (#179) 2023-03-02 23:32:20 -06:00
Sean Sube 22e9d54408
apply lint 2023-03-02 22:32:37 -06:00
Sean Sube be1c8cd79f
feat(api): support ckpt inversions by splitting multivector embeddings into multiple tokens 2023-03-02 22:11:27 -06:00
Sean Sube 9a0d2051fb
fix(api): better logging when converting textual inversions 2023-03-02 07:57:59 -06:00
Sean Sube 46aac263d5
feat(api): initial support for textual inversion embeddings from civitai and others (#179) 2023-03-01 19:09:51 -06:00
Sean Sube 1f3a5f6f3c
fix(api): track completed jobs for each device worker (#170) 2023-03-01 19:09:18 -06:00
Sean Sube 4b77a00ca7
fix(api): load tokenizer with textual inversions 2023-03-01 19:08:31 -06:00
Sean Sube 21fc7c5968
fix(api): mark all convert methods as no_grad 2023-03-01 08:26:40 -06:00
Sean Sube 3f9f94fcb5
apply lint, remove unused 2023-02-28 23:05:17 -06:00
Sean Sube 2f4ab20f61
use filename for tensors 2023-02-28 22:49:53 -06:00
Sean Sube 74aae1b027
fix(api): write external weights into same directory as optimized model 2023-02-28 22:47:02 -06:00
Sean Sube dbf9eaf1a4
fix(api): run shape inference before converting models to fp16
per discussion in https://github.com/microsoft/onnxruntime/issues/14827
2023-02-28 22:36:45 -06:00
Sean Sube 86984be5d4
better error logging during conversion 2023-02-28 22:36:36 -06:00
Sean Sube 9ef89db8b0
extract tensors after conversion 2023-02-28 22:36:33 -06:00
Sean Sube 7e65e21410
reload model from proto file before converting 2023-02-28 22:36:26 -06:00
Sean Sube 2210ee849b
only convert inner nodes with ORT conversion helpers 2023-02-28 22:26:04 -06:00
Sean Sube b532570f54
fix(api): reuse ORT session params for each device 2023-02-28 22:24:38 -06:00
Sean Sube 565873b3ae
test half precision on all diffusion models 2023-02-28 22:23:55 -06:00
Sean Sube 1f9efb433a
apply lint 2023-02-28 22:04:55 -06:00
Sean Sube 12fb7f52bb
fix(api): sanitize filenames in user input 2023-02-28 21:56:12 -06:00
Sean Sube c99aa67220
name threads, max queues, type/lint fixes 2023-02-28 21:44:52 -06:00
Sean Sube c95ac1fbdd
avoid terminating workers because it breaks their queues 2023-02-28 08:53:17 -06:00
Sean Sube 0011f079d4
daemonize queue collectors 2023-02-28 06:55:15 -06:00
Sean Sube cad0d37604
some pending queue logging 2023-02-27 23:43:38 -06:00
Sean Sube 4ae3d9caa2
remove task done 2023-02-27 23:18:37 -06:00
Sean Sube 7e0ccdb1af
remove pending queues after joining 2023-02-27 23:14:20 -06:00
Sean Sube 1ce98ace33
add value error handling 2023-02-27 23:12:53 -06:00
Sean Sube f7f438e767
directly rejoin pool 2023-02-27 23:03:42 -06:00
Sean Sube da6ae5d62f
more logging around shutdown, close queues 2023-02-27 23:01:26 -06:00
Sean Sube 988088d64e
quit workers on keyboard signal 2023-02-27 22:52:43 -06:00
Sean Sube 953e5abd36
handle empty errors 2023-02-27 22:45:29 -06:00
Sean Sube 136759285d
set queue timeouts 2023-02-27 22:37:43 -06:00
Sean Sube 0793b61c3a
consistently pass job key to workers 2023-02-27 22:25:53 -06:00
Sean Sube 06f06f5a11
error handling in all threads 2023-02-27 19:48:51 -06:00
Sean Sube 113ad05293
typo 2023-02-27 17:36:26 -06:00
Sean Sube 2327b24022
join all threads 2023-02-27 17:35:31 -06:00
Sean Sube 66a20e60fe
run logger in a thread, clean up status 2023-02-27 17:14:53 -06:00
Sean Sube 13395933dc
always put progress in active jobs 2023-02-26 20:41:16 -06:00
Sean Sube a37d1a4550
use progress queue 2023-02-26 20:37:22 -06:00
Sean Sube 401ee20526
fix finished flag 2023-02-26 20:13:16 -06:00
Sean Sube 525ee24e91
track started and finished jobs 2023-02-26 20:09:42 -06:00
Sean Sube eb82e73e59
initialize list of finished jobs 2023-02-26 15:26:54 -06:00
Sean Sube b931da1d2c
fix imports, lint 2023-02-26 15:21:58 -06:00
Sean Sube 85118d17c6
clear worker flags between jobs, attempt to record finished jobs again 2023-02-26 15:06:40 -06:00
Sean Sube d1961afdbc
re-implement cancellation 2023-02-26 14:36:32 -06:00
Sean Sube 584dddb5d6
lint all the new stuff 2023-02-26 14:15:30 -06:00
Sean Sube b880b7a121
set process titles, terminate workers 2023-02-26 13:09:24 -06:00
Sean Sube 6502e1e3c8
recycle worker pool after 10 jobs 2023-02-26 12:58:38 -06:00
Sean Sube e0737e9e08
update progress and finished flag from worker 2023-02-26 12:51:11 -06:00
Sean Sube f115326da7
apply patches within workers 2023-02-26 12:32:48 -06:00
Sean Sube e1d0ad54b7
lock per worker, torch before ORT 2023-02-26 12:24:51 -06:00
Sean Sube d765a6f01b
make logger start up well 2023-02-26 11:16:33 -06:00
Sean Sube 6998e8735c
rejoin worker pool 2023-02-26 10:47:31 -06:00
Sean Sube 06c74a7a96
feat(api): remove Flask app from global scope 2023-02-26 10:15:12 -06:00
Sean Sube 943281feb5
wire up worker jobs 2023-02-25 23:55:30 -06:00
Sean Sube f898de8c54
background workers, logger 2023-02-25 23:49:39 -06:00
Sean Sube e46a1e5fd0
begin switching to per-device torch mp workers 2023-02-25 23:16:32 -06:00
Sean Sube e03b637f54
fix(api): only run CUDA GC on CUDA devices 2023-02-25 22:32:01 -06:00
Sean Sube cb8e9e7080
fix scheduler caching 2023-02-25 13:14:34 -06:00
Sean Sube 18f59f034d
avoid passing None as encoder 2023-02-25 13:12:58 -06:00
Sean Sube 3626d69f40
fix(api): correctly handle missing inversion param 2023-02-25 12:54:51 -06:00
Sean Sube 973b0a9352
add context arg 2023-02-25 12:13:22 -06:00
Sean Sube d88f13cbd7
lint LoRA code and extras, replace public paths with context ones 2023-02-25 12:12:10 -06:00
Sean Sube ce74183e97
blend LoRAs into existing model 2023-02-25 11:53:43 -06:00
Sean Sube e8b5ff250d
add none option to inversion menu 2023-02-25 11:53:37 -06:00
Sean Sube 7ad8385c5b
load from encoder path, add default param 2023-02-25 11:53:34 -06:00
Sean Sube 2e7de16778
feat: add a way to select textual inversions 2023-02-25 11:53:32 -06:00
Sean Sube 45f5fca383
use correct fn to make dirs 2023-02-25 11:53:29 -06:00
Sean Sube 3dfaef041e
fix devices, make subdir 2023-02-25 11:53:26 -06:00
Sean Sube 3f4b3fa322
load CLIP on training device 2023-02-25 11:53:23 -06:00
Sean Sube 6b4ced2608
load inversions from extras file 2023-02-25 11:53:20 -06:00
Sean Sube 9dedfc7b28
add experimental LoRA blender 2023-02-25 11:53:17 -06:00
Sean Sube a31f7b9e1f
feat(api): convert Textual Inversion weights 2023-02-25 11:53:13 -06:00
Sean Sube 947a1bfdec
fix variable names 2023-02-25 11:26:10 -06:00
Sean Sube 44393e3770
feat(api): add txt2txt endpoint 2023-02-25 11:20:36 -06:00
Sean Sube fd013c88ef
fix(api): enable optimizations during model conversion 2023-02-23 18:43:49 -06:00
Sean Sube 14c7e6a78c
apply lint 2023-02-21 08:26:09 -06:00
Sean Sube 82016a163a
restore single output in chain pipeline stages 2023-02-21 08:14:04 -06:00
Sean Sube 33ab23a474
convert to list of outputs 2023-02-20 23:47:43 -06:00
Sean Sube b65e4e7cbe
use batch size when generating latents 2023-02-20 21:57:46 -06:00
Sean Sube 2c8bd4b043
read batch parameter from request 2023-02-20 21:46:23 -06:00
Sean Sube 5f3b84827b
feat(api): add batch size to txt2img and img2img pipelines (#195) 2023-02-20 08:35:18 -06:00
Sean Sube 0deaa8898d
fix(api): add missing params to SD upscale 2023-02-19 23:30:48 -06:00
Sean Sube c1189aad96
feat: add eta parameter (fixes #194) 2023-02-19 23:29:26 -06:00
Sean Sube 40e396a2c4
sonar lint fixes 2023-02-19 22:10:35 -06:00
Sean Sube f561dfae83
fix(api): correct blending mask (fixes #188) 2023-02-19 11:04:11 -06:00
Sean Sube c459e96523
fix(api): report accurate size when face correction is run twice 2023-02-19 10:27:05 -06:00
Sean Sube f7eefe4bd2
more sonar lint 2023-02-19 07:54:27 -06:00
Sean Sube c69e342ee4
apply sonar lint 2023-02-19 07:53:20 -06:00
Sean Sube 30978e3e5b
fix(api): only run GC is devices are passed 2023-02-19 07:41:16 -06:00
Sean Sube 3789862a6f
mark unused params, fix shared lists 2023-02-19 07:37:29 -06:00
Sean Sube b7a780bacc
correct param name for upscale mask 2023-02-18 22:53:57 -06:00
Sean Sube 30f16035bc
fix upscale copy ctor 2023-02-18 22:36:26 -06:00
Sean Sube ac1f7449bb
fix(api): use stage source when available 2023-02-18 22:11:44 -06:00
Sean Sube 25c56c7d5c
fix imports 2023-02-18 20:28:21 -06:00
Sean Sube 3fd90a667d
lint(api): remove unused strength param from inpaint pipeline 2023-02-18 18:56:56 -06:00
Sean Sube 1a45aa68fa
clean up some exports, lint 2023-02-18 18:55:42 -06:00
Sean Sube 2b83f942af
restore original LPW names 2023-02-18 18:55:02 -06:00
Sean Sube 4d93c13431
apply lint, fix shadowed names 2023-02-18 17:59:13 -06:00
Sean Sube b4f7973c1e
lint(api): use consistent name for source/mask images to avoid conflict with kwargs 2023-02-18 16:35:57 -06:00
Sean Sube 7b8ced0f68
feat(api): prefer chain stage parameters over request parameters (#138) 2023-02-18 16:27:48 -06:00
Sean Sube bfdb071c2d
chore(docs): explain model optimizations 2023-02-18 16:06:05 -06:00
Sean Sube e0a62ccbb5
better ONNX optimization logging 2023-02-18 15:47:31 -06:00
Sean Sube 881b290116
return session options properly 2023-02-18 15:45:28 -06:00
Sean Sube 5b4c370a1b
feat(api): enable ONNX optimizations through env 2023-02-18 15:44:39 -06:00
Sean Sube 0d2211ff25
apply lint 2023-02-18 14:14:13 -06:00
Sean Sube f534fbb92c
fix(api): restore separate upscale and correction stages 2023-02-18 11:59:39 -06:00
Sean Sube 118695d68c
fix(api): add error handling for optimizations 2023-02-18 11:57:18 -06:00
Sean Sube ab6462d095
feat(api): enable optimizations for SD pipelines based on env vars (#155) 2023-02-18 11:53:13 -06:00
Sean Sube ff57527274
remove unused enum 2023-02-18 11:16:33 -06:00
Sean Sube ffc4eb09f1
update reported image size when correction is run twice 2023-02-18 11:14:34 -06:00
Sean Sube 6dd0edc374
apply lint 2023-02-18 11:05:38 -06:00
Sean Sube f051af359d
make default order match type 2023-02-18 11:05:23 -06:00
Sean Sube ecf3c03f0f
feat: add parameter to run correction before upscaling (#132) 2023-02-18 11:04:08 -06:00
Sean Sube b2de114c8c
fix(api): disable progress in diffusers pipelines 2023-02-18 09:42:38 -06:00
Sean Sube 8dd55cc556
fix(api): disable HF hub progress 2023-02-18 09:37:27 -06:00
Sean Sube 15060e6c7d
fix(api): create conversion context from environment vars 2023-02-18 09:31:20 -06:00
Sean Sube b4e66ef502
feat(api): add flag to disable progress bars (#158) 2023-02-18 09:26:13 -06:00
Sean Sube 400e579491
Merge branch 'feat/113-onnx-resrgan' 2023-02-18 09:23:36 -06:00
Sean Sube b3b10b4746
apply lint 2023-02-18 08:46:46 -06:00
Sean Sube 338fc237c7
fix(api): convert Real ESRGAN v3 using same arch as runtime 2023-02-18 08:41:15 -06:00
Sean Sube 431db6e3f8
repack size into tuples 2023-02-18 05:47:34 -06:00
Sean Sube 3ca02d4875
fix(api): make size params iterable 2023-02-18 05:44:43 -06:00
Sean Sube 0e108daa0f
fix(api): resize images to min dimensions by padding if necessary (#172) 2023-02-18 05:35:53 -06:00
Sean Sube 2c9d96d2ee
feat(api): use ONNX for Real ESRGAN v3 model 2023-02-17 23:25:42 -06:00
Sean Sube ce8c7205dc
apply lint 2023-02-17 22:49:13 -06:00
Sean Sube d09446ca68
fix(api): log number of active threads when running GC (#170) 2023-02-17 21:56:03 -06:00
Sean Sube cf8ca34845
fix(api): correct device for VRAM check 2023-02-17 08:44:42 -06:00
Sean Sube 56a826228d
fix(api): only remove converted VAE if it exists 2023-02-17 08:34:28 -06:00
Sean Sube 7a1f8318ef
fix(api): only convert VAE once when coming from checkpoints 2023-02-17 08:29:23 -06:00
Sean Sube 37b173d0d1
fix(api): unwrap state dict from VAE 2023-02-17 08:23:12 -06:00
Sean Sube c74d22aa42
fix(api): continue converting other models after an error in one (#166) 2023-02-17 07:49:45 -06:00
Sean Sube b3c8fce16b
fix(api): fallback to PyTorch if tensors fail to load with JIT 2023-02-17 07:39:48 -06:00
Sean Sube 005650a9a2
feat(api): log CUDA memory stats (#141) 2023-02-16 23:51:17 -06:00
Sean Sube d42de16a84
feat(api): support custom VAE for diffusers models 2023-02-16 22:52:25 -06:00
Sean Sube 388eb640c0
apply lint, rename lookup table 2023-02-16 22:22:46 -06:00
Sean Sube f5ae9dd492
add ORT type table 2023-02-16 21:50:19 -06:00
Sean Sube 3d73b9e621
fix(api): update SD upscaling pipeline 2023-02-16 21:44:33 -06:00
Sean Sube 873276f1d0
load checkpoint properly 2023-02-16 20:23:10 -06:00
Sean Sube ca1b22d44d
fix(api): support loading VAE from CKPT files 2023-02-16 20:18:42 -06:00
Sean Sube 4b6be765a6
copy VAE without translation 2023-02-16 19:24:02 -06:00
Sean Sube cddbc87ca3
skip key removal for VAE tensors 2023-02-16 19:17:00 -06:00
Sean Sube aa6dc334d7
resolve VAE files within model path 2023-02-16 18:56:54 -06:00
Sean Sube 2c66cc58c5
feat(api): add option for custom VAE to extras file (#145) 2023-02-16 18:53:50 -06:00
Sean Sube 5e9dfa3465
lint(api): lowercase log messages 2023-02-16 18:42:05 -06:00
Sean Sube 0ed4af18ad
fix(api): run torch gc alongside python (#156) 2023-02-16 18:11:35 -06:00
Sean Sube 6a2bac1359
lint(api): remove unused import 2023-02-15 21:01:25 -06:00
Sean Sube 841b18576c
apply lint 2023-02-15 20:50:12 -06:00
Sean Sube d60ec52186
fix(api): report correct image size for blend tab 2023-02-15 18:15:35 -06:00
Sean Sube 32a4bbcd64
fix(api): remove alpha channel after blending but before upscaling (fixes #148) 2023-02-15 17:49:42 -06:00
Sean Sube b5eeb44c62
fix(api): remove inpaint post-multiply (#150) 2023-02-15 17:45:25 -06:00
Sean Sube df5fb93bc0
fix(api): bypass model cache entirely when limit is 0 2023-02-15 17:17:28 -06:00
Sean Sube 2b29b099f0
fix(api): make SD upscaling compatible with more schedulers 2023-02-15 17:16:20 -06:00
Sean Sube 3e5edb1c39
fix(api): restore python 3.8 compatibility (#146) 2023-02-14 21:23:16 -06:00
Sean Sube 4d0cd2e981
apply lint 2023-02-14 19:01:14 -06:00
Sean Sube 8a2a9174ba
fix(api): pass both device and session options to ORT (#38) 2023-02-14 18:57:50 -06:00
Sean Sube feb4603171
fix(api): remove finished jobs from worker pool (#124) 2023-02-14 17:23:23 -06:00
Sean Sube 38f8aa38ee
lint(api): read blending sources in loop 2023-02-14 17:13:29 -06:00
Sean Sube d473a0fd2d
fix(api): pass device options to ORT session (#38) 2023-02-14 17:12:52 -06:00
Sean Sube f2d0025545
feat: add iPNDM scheduler 2023-02-14 07:27:51 -06:00
Sean Sube 1289c560bd
apply lint 2023-02-14 00:12:07 -06:00
Sean Sube 7f6fa22b4e
fix(api): skip model download if final converted version already exists (fixes #139) 2023-02-13 23:03:51 -06:00
Sean Sube 4cc1d63cec
fix(api): make diffusion model config optional again 2023-02-13 22:49:50 -06:00
Sean Sube 6b6f2f0eff
feat: add support for DEIS multistep scheduler 2023-02-13 22:37:54 -06:00
Sean Sube 05756b2b08
fix(api): patch more download paths (#134) 2023-02-13 22:23:17 -06:00
Sean Sube d1b250660e
fix(api): convert blend sources to the same size as the mask 2023-02-13 21:57:47 -06:00
Sean Sube c61f200bc2
fix(api): base model cache size on number of workers 2023-02-13 18:46:33 -06:00
Sean Sube c432ab0795
remove oldest items from model cache first 2023-02-13 18:33:06 -06:00
Sean Sube c6b2751cc1
fix(api): patch download fn in facexlib (#134) 2023-02-13 18:30:09 -06:00
Sean Sube 6d503ca00e
update cache entries with tag and key 2023-02-13 18:27:20 -06:00
Sean Sube 51d53597c0
fix(api): load Real ESRGAN PTH from cache 2023-02-13 18:21:05 -06:00
Sean Sube 8dc1ea7f1f
declare missing cache 2023-02-13 18:15:02 -06:00
Sean Sube f43f793148
fix type 2023-02-13 18:12:40 -06:00
Sean Sube 0709c1dbf0
feat(api): add GFPGAN and Real ESRGAN to model cache 2023-02-13 18:10:11 -06:00
Sean Sube e9472bc005
feat(api): add model cache for diffusion models 2023-02-13 18:04:46 -06:00
Sean Sube 7fa1783be4
feat: implement blend tab and copy buttons (#62) 2023-02-13 17:34:42 -06:00
Sean Sube d6201c9d32
feat(api): add an option for custom checkpoint config to extras file (fixes #130) 2023-02-12 14:10:30 -06:00
Sean Sube 82487f5771
fix(api): separate Real ESRGAN upsampler from GFPGAN stage (#87) 2023-02-12 13:50:28 -06:00
Sean Sube ae8aa2ea7a
apply lint 2023-02-12 13:32:50 -06:00
Sean Sube 034be3266e
fix(api): accumulate progress from inpaint pipelines (#90) 2023-02-12 13:16:17 -06:00
Sean Sube aaf82a42f1
fix(api): use correct var for diffusion scheduler cache 2023-02-12 12:47:55 -06:00
Sean Sube feb7e7d57b
pass progress to txt2img and img2img 2023-02-12 12:38:06 -06:00
Sean Sube 2f6a3afddb
pass progress on to most stages 2023-02-12 12:33:36 -06:00
Sean Sube 9d1c5dca52
fix(api): correctly handle partial extras files 2023-02-12 12:23:03 -06:00
Sean Sube 06d4f32574
make progress callbacks optional 2023-02-12 12:22:11 -06:00
Sean Sube d9fc908592
feat(api): collect progress from chain pipelines (#90) 2023-02-12 12:17:36 -06:00
Sean Sube 27a3fa8f51
feat: show model in image card, use labels for model and scheduler (#104) 2023-02-12 09:51:35 -06:00
Sean Sube 9c5043e9d0
fix(api): correctly cache diffusers scheduler 2023-02-12 09:33:13 -06:00
Sean Sube 1179092028
feat(api): intercept model downloads in libs and use cached copy (fixes #95) 2023-02-12 09:28:37 -06:00
Sean Sube 8ea33e9874
fix(api): patch various download fns to use cache (#95) 2023-02-12 06:25:44 -06:00
Sean Sube 1f06b502d5
fix(api): always fill inpaint/outpaint mask with white 2023-02-11 18:55:22 -06:00
Sean Sube ffbe0929e6
apply lint 2023-02-11 18:10:36 -06:00