Created
April 4, 2016 20:35
-
-
Save lucasb-eyer/377c6de3bc0c882516f33e228722104d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dummy(): | |
def __init__(self, *a, **kw): | |
pass | |
def __setstate__(self, *a, **kw): | |
pass | |
def __getstate__(self, *a, **kw): | |
pass | |
class RestrictedUnpickler(pickle.Unpickler): | |
def find_class(self, module, name): | |
print(module, name) | |
if module.startswith("DeepFried2") or module.startswith("theano"): | |
return Dummy | |
return pickle.Unpickler.find_class(self, module, name) | |
RestrictedUnpickler(open('/tmp/lucfootmp.pkl', 'rb')).load() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment