Skip to content

Instantly share code, notes, and snippets.

@gaphex
Last active May 9, 2019 16:19
Show Gist options
  • Save gaphex/a365bcd0e0df01e8c94fca03ae7bd4f0 to your computer and use it in GitHub Desktop.
Save gaphex/a365bcd0e0df01e8c94fca03ae7bd4f0 to your computer and use it in GitHub Desktop.
# use this for BERT-base
bert_base_config = {
"attention_probs_dropout_prob": 0.1,
"directionality": "bidi",
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"max_position_embeddings": 512,
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pooler_fc_size": 768,
"pooler_num_attention_heads": 12,
"pooler_num_fc_layers": 3,
"pooler_size_per_head": 128,
"pooler_type": "first_token_transform",
"type_vocab_size": 2,
"vocab_size": VOC_SIZE
}
with open("{}/bert_config.json".format(MODEL_DIR), "w") as fo:
json.dump(bert_base_config, fo, indent=2)
with open("{}/{}".format(MODEL_DIR, VOC_FNAME), "w") as fo:
for token in bert_vocab:
fo.write(token+"\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment