system HF staff commited on
Commit
1654f0f
1 Parent(s): 76b7e83

Update convert_model.py

Browse files
Files changed (1) hide show
  1. convert_model.py +12 -0
convert_model.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ from transformers import BertModel, BertTokenizer, TFBertModel
4
+
5
+ logging.basicConfig(level=logging.INFO, filename="log.txt")
6
+ model = BertModel.from_pretrained("../../MiniLM-L12-H384-uncased/")
7
+ tf_model = TFBertModel.from_pretrained("../../MiniLM-L12-H384-uncased/", from_pt=True)
8
+ model.save_pretrained("./")
9
+ tf_model.save_pretrained("./")
10
+
11
+ tok = BertTokenizer.from_pretrained("../../MiniLM-L12-H384-uncased/")
12
+ tok.save_pretrained("./")