mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 02:45:05 +08:00
fix RestrictedUnpickler
it does no harm to remove the pytorch_lightening dependency
see also 735ac4cf81
This commit is contained in:
parent
5865da28d1
commit
b5c5938853
@ -37,6 +37,9 @@ class RestrictedUnpickler(pickle.Unpickler):
|
||||
if res is not None:
|
||||
return res
|
||||
|
||||
class Empty:
|
||||
pass
|
||||
|
||||
if module == 'collections' and name == 'OrderedDict':
|
||||
return getattr(collections, name)
|
||||
if module == 'torch._utils' and name in ['_rebuild_tensor_v2', '_rebuild_parameter', '_rebuild_device_tensor_from_numpy']:
|
||||
@ -51,12 +54,8 @@ class RestrictedUnpickler(pickle.Unpickler):
|
||||
return getattr(numpy, name)
|
||||
if module == '_codecs' and name == 'encode':
|
||||
return encode
|
||||
if module == "pytorch_lightning.callbacks" and name == 'model_checkpoint':
|
||||
import pytorch_lightning.callbacks
|
||||
return pytorch_lightning.callbacks.model_checkpoint
|
||||
if module == "pytorch_lightning.callbacks.model_checkpoint" and name == 'ModelCheckpoint':
|
||||
import pytorch_lightning.callbacks.model_checkpoint
|
||||
return pytorch_lightning.callbacks.model_checkpoint.ModelCheckpoint
|
||||
if module.startswith("pytorch_lightning"):
|
||||
return Empty
|
||||
if module == "__builtin__" and name == 'set':
|
||||
return set
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user