Instructions to use microsoft/Multilingual-MiniLM-L12-H384 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Multilingual-MiniLM-L12-H384 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="microsoft/Multilingual-MiniLM-L12-H384")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/Multilingual-MiniLM-L12-H384", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
File size: 538 Bytes
1a8eef3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/usr/bin/env python3
import logging
from transformers import BertModel, BertTokenizer, TFBertModel, XLMRobertaTokenizer
logging.basicConfig(level=logging.INFO, filename="log.txt")
model = BertModel.from_pretrained("../../Multilingual-MiniLM-L12-H384/")
tf_model = TFBertModel.from_pretrained("../../Multilingual-MiniLM-L12-H384/", from_pt=True)
model.save_pretrained("./")
tf_model.save_pretrained("./")
tok = XLMRobertaTokenizer.from_pretrained("../../Multilingual-MiniLM-L12-H384/sentencepiece.bpe.model")
tok.save_pretrained("./")
|