Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error(s) in loading state_dict for KobertBiEncoder #10

Open
Chanwhistle opened this issue Oct 12, 2023 · 0 comments
Open

Error(s) in loading state_dict for KobertBiEncoder #10

Chanwhistle opened this issue Oct 12, 2023 · 0 comments

Comments

@Chanwhistle
Copy link

Chanwhistle commented Oct 12, 2023

rm = KobertBiEncoder()
rm.load("/KorDPR/2050iter_model/2050iter_model.pt")
index = DenseFlatIndexer()
index.deserialize(path="/KorDPR/2050iter_model")

이렇게 하면

RuntimeError                              Traceback (most recent call last)
/home/chanhwi/HeriGPT/test.ipynb 셀 3 line 2
      [1](vscode-notebook-cell://ssh-remote%2B163.152.20.133/home/chanhwi/HeriGPT/test.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) rm = KobertBiEncoder()
----> [2](vscode-notebook-cell://ssh-remote%2B163.152.20.133/home/chanhwi/HeriGPT/test.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1) rm.load("/home/chanhwi/HeriGPT/KorDPR/2050iter_model/2050iter_model.pt")
      [3](vscode-notebook-cell://ssh-remote%2B163.152.20.133/home/chanhwi/HeriGPT/test.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2) # index = DenseFlatIndexer()
      [4](vscode-notebook-cell://ssh-remote%2B163.152.20.133/home/chanhwi/HeriGPT/test.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3) # index.deserialize(path="/home/chanhwi/HeriGPT/KorDPR/2050iter_model")

File [~/HeriGPT/KorDPR/encoder.py:53](https://vscode-remote+ssh-002dremote-002b163-002e152-002e20-002e133.vscode-resource.vscode-cdn.net/home/chanhwi/HeriGPT/~/HeriGPT/KorDPR/encoder.py:53), in KobertBiEncoder.load(self, model_ckpt_path)
     51 with open(model_ckpt_path, "rb") as f:
     52     state_dict = torch.load(f)
---> 53 self.load_state_dict(state_dict)
     54 logger.debug(f"model self.state_dict loaded from {model_ckpt_path}")

File [~/miniconda3/envs/heri/lib/python3.9/site-packages/torch/nn/modules/module.py:1482](https://vscode-remote+ssh-002dremote-002b163-002e152-002e20-002e133.vscode-resource.vscode-cdn.net/home/chanhwi/HeriGPT/~/miniconda3/envs/heri/lib/python3.9/site-packages/torch/nn/modules/module.py:1482), in Module.load_state_dict(self, state_dict, strict)
   1477         error_msgs.insert(
   1478             0, 'Missing key(s) in state_dict: {}. '.format(
   1479                 ', '.join('"{}"'.format(k) for k in missing_keys)))
   1481 if len(error_msgs) > 0:
-> 1482     raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
   1483                        self.__class__.__name__, "\n\t".join(error_msgs)))
   1484 return _IncompatibleKeys(missing_keys, unexpected_keys)

RuntimeError: Error(s) in loading state_dict for KobertBiEncoder:
	Unexpected key(s) in state_dict: "passage_encoder.embeddings.position_ids", "query_encoder.embeddings.position_ids".

에러가 발생합니다.

혹시 어떻게 해결할 수 있을까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant