Commit Graph

18 Commits

Author SHA1 Message Date
Aarni Koskela e3fa46f26f Fix various typos with crate-ci/typos 2024-03-04 08:42:07 +02:00
hidenorly 81c00728b8 Fix the Ruff error about unused import 2023-11-29 04:59:35 +09:00
hidenorly a0096c5897 Add FP32 fallback support on torch.nn.functional.interpolate
This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```
2023-11-29 04:45:04 +09:00
brkirch 5df535b7c2 Remove duplicate code for torchsde randn 2023-08-13 10:07:52 -04:00
AUTOMATIC1111 386245a264 split shared.py into multiple files; should resolve all circular reference import errors related to shared.py 2023-08-09 10:25:35 +03:00
Aarni Koskela 3d524fd3f1 Don't do MPS GC when there's a latent that could still be sampled 2023-07-12 15:17:30 +03:00
Aarni Koskela 8f6b24ce59 Add correct logger name 2023-07-12 15:16:42 +03:00
Aarni Koskela b85fc7187d Fix MPS cache cleanup
Importing torch does not import torch.mps so the call failed.
2023-07-11 12:51:05 +03:00
Hao-Wu daf41a2734 Fix warning of 'has_mps' is deprecated from PyTorch 2023-07-06 15:37:10 +08:00
Aarni Koskela 49a55b410b Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
AUTOMATIC f741a98bac imports cleanup for ruff 2023-05-10 08:43:42 +03:00
brkirch de401d8ffb Fix generation with k-diffusion/UniPC on x64 Macs 2023-05-09 01:10:13 -04:00
brkirch 9efb809f7c Remove PyTorch 2.0 check
Apparently the commit in the main branch of pytorch/pytorch that fixes this issue didn't make it into PyTorch 2.0.1, and since it is unclear exactly which release will have it we'll just always apply the workaround so a crash doesn't occur regardless.
2023-05-09 01:10:13 -04:00
brkirch 27fe3eb6a9 Add workaround for MPS layer_norm on PyTorch 2.0
On PyTorch 2.0, with MPS layer_norm only accepts float32 inputs. This was fixed shortly after 2.0 was finalized so the workaround can be applied with an exact version match.
2023-03-24 04:04:22 -04:00
brkirch c5142e2fbe Add workaround for broken nn.Linear on macOS 13.2
Credit to danieldk (https://github.com/explosion/curated-transformers/pull/124) for the workaround this is based on.
2023-03-24 04:04:20 -04:00
brkirch a4cb96d4ae Remove test, use bool tensor fix by default
The test isn't working correctly on macOS 13.3 and the bool tensor fix for cumsum is currently always needed anyway, so enable the fix by default.
2023-03-11 17:35:17 -05:00
brkirch 4306659c4d Remove unused code 2023-02-04 01:22:06 -05:00
brkirch 1b8af15f13 Refactor Mac specific code to a separate file
Move most Mac related code to a separate file, don't even load it unless web UI is run under macOS.
2023-02-01 14:05:56 -05:00