diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-12-24 05:34:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 05:34:46 +0000 |
commit | 3bfc6c07ae9197bdbd9144cb0b82a137e3e94247 (patch) | |
tree | 34ecc6fa817b80d2a5430687959c82427d610c82 /modules/safe.py | |
parent | f0dfed2a1714f05aa3d87ad475b2615ee9c7972c (diff) | |
parent | cca16373def60bfc6d159a3c2dca91d0ba48112a (diff) | |
download | stable-diffusion-webui-gfx803-3bfc6c07ae9197bdbd9144cb0b82a137e3e94247.tar.gz stable-diffusion-webui-gfx803-3bfc6c07ae9197bdbd9144cb0b82a137e3e94247.tar.bz2 stable-diffusion-webui-gfx803-3bfc6c07ae9197bdbd9144cb0b82a137e3e94247.zip |
Merge pull request #5810 from brkirch/fix-training-mps
Training fixes for MPS
Diffstat (limited to 'modules/safe.py')
-rw-r--r-- | modules/safe.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/safe.py b/modules/safe.py index 10460ad0..7c89c4c2 100644 --- a/modules/safe.py +++ b/modules/safe.py @@ -37,16 +37,16 @@ class RestrictedUnpickler(pickle.Unpickler): if module == 'collections' and name == 'OrderedDict':
return getattr(collections, name)
- if module == 'torch._utils' and name in ['_rebuild_tensor_v2', '_rebuild_parameter']:
+ if module == 'torch._utils' and name in ['_rebuild_tensor_v2', '_rebuild_parameter', '_rebuild_device_tensor_from_numpy']:
return getattr(torch._utils, name)
- if module == 'torch' and name in ['FloatStorage', 'HalfStorage', 'IntStorage', 'LongStorage', 'DoubleStorage', 'ByteStorage']:
+ if module == 'torch' and name in ['FloatStorage', 'HalfStorage', 'IntStorage', 'LongStorage', 'DoubleStorage', 'ByteStorage', 'float32']:
return getattr(torch, name)
if module == 'torch.nn.modules.container' and name in ['ParameterDict']:
return getattr(torch.nn.modules.container, name)
- if module == 'numpy.core.multiarray' and name == 'scalar':
- return numpy.core.multiarray.scalar
- if module == 'numpy' and name == 'dtype':
- return numpy.dtype
+ if module == 'numpy.core.multiarray' and name in ['scalar', '_reconstruct']:
+ return getattr(numpy.core.multiarray, name)
+ if module == 'numpy' and name in ['dtype', 'ndarray']:
+ return getattr(numpy, name)
if module == '_codecs' and name == 'encode':
return encode
if module == "pytorch_lightning.callbacks" and name == 'model_checkpoint':
|