Skip to content

Function hook does not work on all PyTorch inputs  #80

Open

Description

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions