def variable_mapping(self):
    '映射到官方GPT2_ML权重格式\n        '
    mapping = {'Embedding-Token': ['newslm/embeddings/word_embed'], 'Embedding-Position': ['newslm/embeddings/pos_embed'], 'Embedding-Norm': ['newslm/embeddings/LayerNorm_embed_norm/beta', 'newslm/embeddings/LayerNorm_embed_norm/gamma']}
    for i in range(self.num_hidden_layers):
        prefix = ('newslm/layer%02d/' % i)
        mapping.update({('Transformer-%d-MultiHeadSelfAttention' % i): [(prefix + 'query_layer/kernel'), (prefix + 'query_layer/bias'), (prefix + 'key_layer/kernel'), (prefix + 'key_layer/bias'), (prefix + 'value_layer/kernel'), (prefix + 'value_layer/bias'), (prefix + 'context_projection_layer/kernel'), (prefix + 'context_projection_layer/bias')], ('Transformer-%d-FeedForward-Norm-0' % i): [(prefix + 'LayerNorm_mlp_ln0/beta'), (prefix + 'LayerNorm_mlp_ln0/gamma')], ('Transformer-%d-FeedForward' % i): [(prefix + 'intermediate/kernel'), (prefix + 'intermediate/bias'), (prefix + 'output/kernel'), (prefix + 'output/bias')], ('Transformer-%d-FeedForward-Norm-1' % i): [(prefix + 'LayerNorm_mlp_ln1/beta'), (prefix + 'LayerNorm_mlp_ln1/gamma')]})
    return mapping
映射到官方GPT2_ML权重格式
def variable_mapping(self):
    '\n        '
    mapping = {'Embedding-Token': ['newslm/embeddings/word_embed'], 'Embedding-Position': ['newslm/embeddings/pos_embed'], 'Embedding-Norm': ['newslm/embeddings/LayerNorm_embed_norm/beta', 'newslm/embeddings/LayerNorm_embed_norm/gamma']}
    for i in range(self.num_hidden_layers):
        prefix = ('newslm/layer%02d/' % i)
        mapping.update({('Transformer-%d-MultiHeadSelfAttention' % i): [(prefix + 'query_layer/kernel'), (prefix + 'query_layer/bias'), (prefix + 'key_layer/kernel'), (prefix + 'key_layer/bias'), (prefix + 'value_layer/kernel'), (prefix + 'value_layer/bias'), (prefix + 'context_projection_layer/kernel'), (prefix + 'context_projection_layer/bias')], ('Transformer-%d-FeedForward-Norm-0' % i): [(prefix + 'LayerNorm_mlp_ln0/beta'), (prefix + 'LayerNorm_mlp_ln0/gamma')], ('Transformer-%d-FeedForward' % i): [(prefix + 'intermediate/kernel'), (prefix + 'intermediate/bias'), (prefix + 'output/kernel'), (prefix + 'output/bias')], ('Transformer-%d-FeedForward-Norm-1' % i): [(prefix + 'LayerNorm_mlp_ln1/beta'), (prefix + 'LayerNorm_mlp_ln1/gamma')]})
    return mapping