REDN
REDN copied to clipboard
RuntimeError: storage has wrong size: expected -4883207186230854459 got 768
When I am trying to load trained model with model.load_state_dict(torch.load("ckpt") I am getting this RuntimeError: storage has wrong size: expected -4883207186230854459 got 768 error. When I searched it says it might be related with workers overwriting on to the same file so how can I resolve this?
Thanks
Still waiting an answer on that issue can you please help me on that?
from opennre import encoder, model, framework
import json
import os
import torch
import opennre
root_path = '.'
rel2id = json.load(open(os.path.join(root_path, 'benchmark/nyt10/rel2id.json')))
# Define the sentence encoder
sentence_encoder = opennre.encoder.BERTEncoder(
max_length=128,
pretrain_path="bert-base-uncased"
)
m = model.SoftmaxNN(sentence_encoder, len(rel2id), rel2id)
m.load_state_dict(torch.load("ckpt/Newmodel_nyt10_sigmoid_withCLS_-2_768_bert.th")['state_dict'])
When I run this script I am getting "RuntimeError: storage has wrong size: expected -4883207186230854459 got 768" error. Thanks
Maybe you open multiple instances of this code but without change the saving directory?