MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / set_state_dict

Method set_state_dict

codegeex/paddle/codegeex_model.py:802–815  ·  view source on GitHub ↗

Customized load.

(self, state_dict, use_structured_name=True)

Source from the content-addressed store, hash-verified

800 return state_dict_
801
802 def set_state_dict(self, state_dict, use_structured_name=True):
803 """Customized load."""
804
805 # Position embedding.
806 if self._top_query_embeddings_key in state_dict:
807 state_dict_ = state_dict[self._top_query_embeddings_key]
808 else:
809 # for backward compatibility.
810 state_dict_ = {}
811 for key in state_dict.keys():
812 if 'top_query_embeddings' in key:
813 state_dict_[key.split('top_query_embeddings.')[1]] \
814 = state_dict[key]
815 self.top_query_embeddings.set_state_dict(state_dict_, use_structured_name=use_structured_name)
816
817
818class TransformerLanguageModel(paddle.nn.Layer):

Callers

nothing calls this directly

Calls 1

set_state_dictMethod · 0.45

Tested by

no test coverage detected