UKPLab / starsem2018-entity-linking

Accompanying code for our *SEM 2018 @ NAACL 2018 paper "Mixing Context Granularities for Improved Entity Linking on Question Answering Data across Entity Categories"
Apache License 2.0
59 stars 16 forks source link

_pickle.UnpicklingError: invalid load key, '{'. #2

Closed Jorigorn closed 4 years ago

Jorigorn commented 5 years ago

Hi, Maybe the pickle file is not saved properly, could you please have a look at the file?

% python test.py Traceback (most recent call last): File "test.py", line 8, in entitylinker = core.MLLinker(path_to_model="trainedmodels/FeatureModel_SimplifiedVCG.param") File "/john/starsem2018-entity-linking/entitylinking/core/ml_entity_linker.py", line 20, in init self._elmodel.load_from_file(path_to_model) File "/john/starsem2018-entity-linking/entitylinking/mlearning/models/pytorchmodel.py", line 403, in load_from_file super(ELModel, self).load_from_file(path_to_model) File "/john/starsem2018-entity-linking/entitylinking/mlearning/models/pytorchmodel.py", line 162, in load_from_file self._model.load_state_dict(torch.load(path_to_model)) File "/home/zchen/anaconda3/envs/starsem2018/lib/python3.6/site-packages/torch/serialization.py", line 267, in load return _load(f, map_location, pickle_module) File "/home/zchen/anaconda3/envs/starsem2018/lib/python3.6/site-packages/torch/serialization.py", line 410, in _load magic_number = pickle_module.load(f) _pickle.UnpicklingError: invalid load key, '{'.

test.py:

coding=utf-8

from entitylinking import core

entitylinker = core.MLLinker(path_to_model="trainedmodels/FeatureModel_Baseline.torchweights")

FeatureModel_SimplifiedVCG.param

entitylinker = core.MLLinker(path_to_model="trainedmodels/FeatureModel_SimplifiedVCG.param")

entitylinker = core.MLLinker(path_to_model="trainedmodels/FeatureModel_Baseline.torchweights")

output = entitylinker.link_entities_in_raw_input("Barack Obama is a president.") print(output.entities)

daniilsorokin commented 5 years ago

Hi,

sometimes git messes up pickle files, try downloading the models from our server: https://public.ukp.informatik.tu-darmstadt.de/starsem18-entity-linking/FeatureModel_SimplifiedVCG.zip

Daniil