aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #14171 from Nuullll/ipexAUTOMATIC11112023-12-021-0/+13
|\ | | | | Initial IPEX support for Intel Arc GPU
| * Disable ipex autocast due to its bad perfNuullll2023-12-021-7/+13
| |
| * Initial IPEX supportNuullll2023-11-301-2/+9
| |
* | Merge pull request #14131 from read-0nly/patch-1AUTOMATIC11112023-12-021-1/+1
|\ \ | |/ |/| Update devices.py - Make 'use-cpu all' actually apply to 'all'
| * Update devices.pyobsol2023-11-281-1/+1
| | | | | | | | | | fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/14097
* | fix for crash when running #12924 without --device-idAUTOMATIC11112023-09-091-1/+1
| |
* | More accurate check for enabling cuDNN benchmark on 16XX cardscatboxanon2023-08-311-1/+2
|/
* split shared.py into multiple files; should resolve all circular reference ↵AUTOMATIC11112023-08-091-9/+1
| | | | import errors related to shared.py
* rework RNG to use generators instead of generating noises beforehandAUTOMATIC11112023-08-091-79/+2
|
* rework torchsde._brownian.brownian_interval replacement to use ↵AUTOMATIC11112023-08-031-6/+38
| | | | device.randn_local and respect the NV setting.
* add NV option for Random number generator source setting, which allows to ↵AUTOMATIC11112023-08-021-2/+37
| | | | generate same pictures on CPU/AMD/Mac as on NVidia videocards.
* Fix MPS cache cleanupAarni Koskela2023-07-111-2/+3
| | | | Importing torch does not import torch.mps so the call failed.
* added torch.mps.empty_cache() to torch_gc()AUTOMATIC11112023-07-081-0/+3
| | | | changed a bunch of places that use torch.cuda.empty_cache() to use torch_gc() instead
* Remove a bunch of unused/vestigial codeAarni Koskela2023-06-051-7/+0
| | | | As found by Vulture and some eyes
* run basic torch calculation at startup in parallel to reduce the performance ↵AUTOMATIC2023-05-211-0/+18
| | | | impact of first generation
* ruff auto fixesAUTOMATIC2023-05-101-1/+1
|
* rename CPU RNG to RNG source in settings, add infotext and parameters ↵AUTOMATIC2023-04-291-2/+2
| | | | copypaste support to RNG source
* Option to use CPU for random number generation.Deciare2023-04-191-2/+6
| | | | | | | Makes a given manual seed generate the same images across different platforms, independently of the GPU architecture in use. Fixes #9613.
* Refactor Mac specific code to a separate filebrkirch2023-02-011-45/+7
| | | | Move most Mac related code to a separate file, don't even load it unless web UI is run under macOS.
* Refactor MPS fixes to CondFuncbrkirch2023-02-011-36/+14
|
* MPS fix is still needed :(brkirch2023-02-011-0/+3
| | | | Apparently I did not test with large enough images to trigger the bug with torch.narrow on MPS
* Merge pull request #7309 from brkirch/fix-embeddingsAUTOMATIC11112023-01-281-3/+8
|\ | | | | Fix embeddings, upscalers, and refactor `--upcast-sampling`
| * Remove MPS fix no longer needed for PyTorchbrkirch2023-01-281-3/+0
| | | | | | | | The torch.narrow fix was required for nightly PyTorch builds for a while to prevent a hard crash, but newer nightly builds don't have this issue.
| * Refactor conditional casting, fix upscalersbrkirch2023-01-281-0/+8
| |
* | clarify the option to disable NaN check.AUTOMATIC2023-01-271-0/+2
| |
* | remove the need to place configs near modelsAUTOMATIC2023-01-271-4/+8
|/
* Add UI setting for upcasting attention to float32brkirch2023-01-251-1/+5
| | | | | | Adds "Upcast cross attention layer to float32" option in Stable Diffusion settings. This allows for generating images using SD 2.1 models without --no-half or xFormers. In order to make upcasting cross attention layer optimizations possible it is necessary to indent several sections of code in sd_hijack_optimizations.py so that a context manager can be used to disable autocast. Also, even though Stable Diffusion (and Diffusers) only upcast q and k, unfortunately my findings were that most of the cross attention layer optimizations could not function unless v is upcast also.
* Add option for float32 sampling with float16 UNetbrkirch2023-01-251-0/+2
| | | | This also handles type casting so that ROCm and MPS torch devices work correctly without --no-half. One cast is required for deepbooru in deepbooru_model.py, some explicit casting is required for img2img and inpainting. depth_model can't be converted to float16 or it won't work correctly on some systems (it's known to have issues on MPS) so in sd_models.py model.depth_model is removed for model.half().
* Merge pull request #6922 from brkirch/cumsum-fixAUTOMATIC11112023-01-191-4/+7
|\ | | | | Improve cumsum fix for MPS
| * Fix cumsum for MPS in newer torchbrkirch2023-01-181-4/+7
| | | | | | | | The prior fix assumed that testing int16 was enough to determine if a fix is needed, but a recent fix for cumsum has int16 working but not bool.
* | disable the new NaN check for the CIAUTOMATIC2023-01-171-0/+3
| |
* | Add a check and explanation for tensor with all NaNs.AUTOMATIC2023-01-161-0/+28
|/
* Add support for PyTorch nightly and local buildsbrkirch2023-01-061-5/+23
|
* Add numpy fix for MPS on PyTorch 1.12.1brkirch2022-12-171-0/+9
| | | | | | | When saving training results with torch.save(), an exception is thrown: "RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead." So for MPS, check if Tensor.requires_grad and detach() if necessary.
* add built-in extension systemAUTOMATIC2022-12-031-1/+10
| | | | | add support for adding upscalers in extensions move LDSR, ScuNET and SwinIR to built-in extensions
* add comment for #4407 and remove seemingly unnecessary cudnn.enabledAUTOMATIC2022-12-031-1/+3
|
* fix #4407 breaking UI entirely for card other than ones related to the PRAUTOMATIC2022-12-031-4/+2
|
* Merge pull request #4407 from yoinked-h/patch-1AUTOMATIC11112022-12-031-0/+7
|\ | | | | Fix issue with 16xx cards
| * actual better fixpepe10-gpu2022-11-081-5/+2
| | | | | | thanks C43H66N12O12S2
| * terrible hackpepe10-gpu2022-11-081-2/+9
| |
| * 16xx card fixpepe10-gpu2022-11-071-0/+3
| | | | | | cudnn
* | Rework MPS randn fix, add randn_like fixbrkirch2022-11-301-12/+3
| | | | | | | | torch.manual_seed() already sets a CPU generator, so there is no reason to create a CPU generator manually. torch.randn_like also needs a MPS fix for k-diffusion, but a torch hijack with randn_like already exists so it can also be used for that.
* | Merge pull request #4918 from brkirch/pytorch-fixesAUTOMATIC11112022-11-271-7/+24
|\ \ | | | | | | Fixes for PyTorch 1.12.1 when using MPS
| * | Add fixes for PyTorch 1.12.1brkirch2022-11-211-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | Fix typo "MasOS" -> "macOS" If MPS is available and PyTorch is an earlier version than 1.13: * Monkey patch torch.Tensor.to to ensure all tensors sent to MPS are contiguous * Monkey patch torch.nn.functional.layer_norm to ensure input tensor is contiguous (required for this program to work with MPS on unmodified PyTorch 1.12.1)
| * | Revert "MPS Upscalers Fix"brkirch2022-11-171-9/+0
| | | | | | | | | | | | This reverts commit 768b95394a8500da639b947508f78296524f1836.
* | | eliminate duplicated code from #5095AUTOMATIC2022-11-271-19/+11
| | |
* | | torch.cuda.empty_cache() defaults to cuda:0 device unless explicitly set ↵Matthew McGoogan2022-11-261-2/+12
|/ / | | | | | | otherwise first. Updating torch_gc() to use the device set by --device-id if specified to avoid OOM edge cases on multi-GPU systems.
* | change formatting to match the main program in devices.pyAUTOMATIC2022-11-121-5/+16
| |
* | Update devices.py源文雨2022-11-121-1/+1
| |
* | Fix wrong mps selection below MasOS 12.3源文雨2022-11-121-3/+10
|/