Customized load.
(self, state_dict, strict=True)
| 801 | return state_dict_ |
| 802 | |
| 803 | def load_state_dict(self, state_dict, strict=True): |
| 804 | """Customized load.""" |
| 805 | |
| 806 | # Position embedding. |
| 807 | if self._top_query_embeddings_key in state_dict: |
| 808 | state_dict_ = state_dict[self._top_query_embeddings_key] |
| 809 | else: |
| 810 | # for backward compatibility. |
| 811 | state_dict_ = {} |
| 812 | for key in state_dict.keys(): |
| 813 | if 'top_query_embeddings' in key: |
| 814 | state_dict_[key.split('top_query_embeddings.')[1]] \ |
| 815 | = state_dict[key] |
| 816 | self.top_query_embeddings.load_state_dict(state_dict_, strict=strict) |
| 817 | |
| 818 | |
| 819 | class TransformerLanguageModel(torch.nn.Module): |
nothing calls this directly
no test coverage detected