fickling
fickling copied to clipboard
Function hook does not work on all PyTorch inputs
The global function hook (shown in hook_functions.py does not work on all PyTorch model inputs. I added print statements in hook.run_hook and fickling.load() to demonstrate. More concretely, it does not work on PyTorch v1.3 files, but it does work on PyTorch v0.1.10 files.
PoC:
import os
import pickle
import numpy
import fickling.hook as hook
import torch
import torchvision.models as models
hook.run_hook()
model = models.mobilenet_v2()
torch.save(model, "model.pt")
torch.save(model, "legacy_model.pt", _use_new_zipfile_serialization=False)
print("\n\nMODEL\n\n")
torch.load("model.pt")
print("LEGACY MODEL")
torch.load("legacy_model.pt")
Output:
Running hook!
MODEL
LEGACY MODEL
Running fickling.load()
Running fickling.load()
Running fickling.load()
Running fickling.load()