diff options
author | brkirch <brkirch@users.noreply.github.com> | 2022-12-17 08:21:19 +0000 |
---|---|---|
committer | brkirch <brkirch@users.noreply.github.com> | 2022-12-17 09:22:58 +0000 |
commit | 16b4509fa60ec03102b2452b41799dafccd35970 (patch) | |
tree | 37efe0fbd67c70902a5d39f8d5249b9ef3e89ed6 /modules/safe.py | |
parent | 685f9631b56ff8bd43bce24ff5ce0f9a0e9af490 (diff) | |
download | stable-diffusion-webui-gfx803-16b4509fa60ec03102b2452b41799dafccd35970.tar.gz stable-diffusion-webui-gfx803-16b4509fa60ec03102b2452b41799dafccd35970.tar.bz2 stable-diffusion-webui-gfx803-16b4509fa60ec03102b2452b41799dafccd35970.zip |
Add numpy fix for MPS on PyTorch 1.12.1
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.
Diffstat (limited to 'modules/safe.py')
0 files changed, 0 insertions, 0 deletions