Skip to content

Instantly share code, notes, and snippets.

@gaphex
Last active November 16, 2019 21:49
Show Gist options
  • Save gaphex/c2c119d0d1d0d44f1938b5ad31bf7426 to your computer and use it in GitHub Desktop.
Save gaphex/c2c119d0d1d0d44f1938b5ad31bf7426 to your computer and use it in GitHub Desktop.
MODEL_DIR = "uncased_L-12_H-768_A-12"
config_path = "/content/{}/bert_config.json".format(MODEL_DIR)
vocab_path = "/content/{}/vocab.txt".format(MODEL_DIR)
tags_and_args = []
for is_training in (True, False):
tags = set()
if is_training:
tags.add("train")
tags_and_args.append((tags, dict(is_training=is_training)))
module_fn = build_module_fn(config_path, vocab_path)
spec = hub.create_module_spec(module_fn, tags_and_args=tags_and_args)
spec.export("bert-module",
checkpoint_path="/content/{}/bert_model.ckpt".format(MODEL_DIR))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment