Update convert_model.py
Browse files- 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, XLMRobertaTokenizer
|
4 |
+
|
5 |
+
logging.basicConfig(level=logging.INFO, filename="log.txt")
|
6 |
+
model = BertModel.from_pretrained("../../Multilingual-MiniLM-L12-H384/")
|
7 |
+
tf_model = TFBertModel.from_pretrained("../../Multilingual-MiniLM-L12-H384/", from_pt=True)
|
8 |
+
model.save_pretrained("./")
|
9 |
+
tf_model.save_pretrained("./")
|
10 |
+
|
11 |
+
tok = XLMRobertaTokenizer.from_pretrained("../../Multilingual-MiniLM-L12-H384/sentencepiece.bpe.model")
|
12 |
+
tok.save_pretrained("./")
|