ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnpicklingError: A load persistent id instruction was encountered, but no persistent_load function was specified.

deven-gqc opened this issue · comments

I have a model trained with Pytorch which does instance segmentation, I'm trying to load the model in instanceSegmentation, but I keep getting a UnpicklingError error. When I load that same model with pytorch it works alright. I don't know what is going wrong over here.

image

Loading the model with pytorch works fine.
image

Here is the entire stacktrace

---------------------------------------------------------------------------
UnpicklingError                           Traceback (most recent call last)
[<ipython-input-14-e2c74af97b78>](https://localhost:8080/#) in <module>
----> 1 ins.load_model("/content/drive/MyDrive/models/fastai_tfl_253img.pkl", network_backbone='resnet34')

4 frames
[/usr/local/lib/python3.7/dist-packages/pixellib/torchbackend/instance/__init__.py](https://localhost:8080/#) in load_model(self, model_path, confidence, detection_speed, network_backbone)
     89 
     90         self.cfg.MODEL.WEIGHTS = model_path
---> 91         self.predictor = DefaultPredictor(self.cfg)
     92 
     93 

[/usr/local/lib/python3.7/dist-packages/pixellib/torchbackend/instance/engine/defaultseng.py](https://localhost:8080/#) in __init__(self, cfg)
    290 
    291         checkpointer = DetectionCheckpointer(self.model)
--> 292         checkpointer.load(cfg.MODEL.WEIGHTS)
    293 
    294         self.aug = T.ResizeShortestEdge(

[/usr/local/lib/python3.7/dist-packages/pixellib/torchbackend/instance/checkpoint/detection_checkpoint.py](https://localhost:8080/#) in load(self, path, *args, **kwargs)
     51             if not has_file:
     52                 path = None  # don't load if not readable
---> 53         ret = super().load(path, *args, **kwargs)
     54 
     55         if need_sync:

[/usr/local/lib/python3.7/dist-packages/fvcore/common/checkpoint.py](https://localhost:8080/#) in load(self, path, checkpointables)
    153             assert os.path.isfile(path), "Checkpoint {} not found!".format(path)
    154 
--> 155         checkpoint = self._load_file(path)
    156         incompatible = self._load_model(checkpoint)
    157         if (

[/usr/local/lib/python3.7/dist-packages/pixellib/torchbackend/instance/checkpoint/detection_checkpoint.py](https://localhost:8080/#) in _load_file(self, filename)
     62         if filename.endswith(".pkl"):
     63             with PathManager.open(filename, "rb") as f:
---> 64                 data = pickle.load(f, encoding="latin1")
     65             if "model" in data and "__author__" in data:
     66                 # file is in Detectron2 model zoo format

UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.