You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this library OpenNRE which is excellent.
When running the following example code:
importopennremodel_name: str="wiki80_bert_softmax"model: opennre.model.softmax_nn.SoftmaxNN=opennre.get_model(model_name)
input_sent: dict= {
"text": "He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).",
"h": { "pos": (18, 46), },
"t": { "pos": (78, 91), },
}
result: tuple=model.infer(input_sent)
print(result)
The following exception gets thrown:
File "/Users/paco/src/OpenNRE/opennre/pretrain.py", line 161, in get_model
m.load_state_dict(torch.load(ckpt, map_location='cpu')['state_dict'])
File "/Users/paco/src/OpenNRE/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SoftmaxNN:
Unexpected key(s) in state_dict: "sentence_encoder.bert.embeddings.position_ids".
Looking at the contents of that dictionary at inference time:
This issue is addressed by https://github.com/thunlp/OpenNRE/issues/312, however when i tried installing transformers==3.4.0, a problem with Rust came up saying no rust compiler found. Thus, after a little search, the following command should install the Rust compiler for you: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
However, another problem came up, if you stuck on the installation of this rust compiler, then you may encounter the same issue as me. The solution is to export 2 environment vars first, then run that command:
Thank you for this library
OpenNRE
which is excellent.When running the following example code:
The following exception gets thrown:
Looking at the contents of that dictionary at inference time:
tensor contents
Should that dictionary element
"sentence_encoder.bert.embeddings.position_ids"
be removed?Or is there another known workaround?
The text was updated successfully, but these errors were encountered: