MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX / load_state_dict

Method load_state_dict

codegeex/torch/codegeex_model.py:803–816  ·  view source on GitHub ↗

Customized load.

(self, state_dict, strict=True)

Source from the content-addressed store, hash-verified

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
819class TransformerLanguageModel(torch.nn.Module):

Callers

nothing calls this directly

Calls 1

load_state_dictMethod · 0.45

Tested by

no test coverage detected