Instructions to use mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16") model = AutoModelForMaskedLM.from_pretrained("mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16") - MLX
How to use mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir answerdotai-ModernBERT-Large-Instruct-bf16 mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
metadata
library_name: transformers
license: apache-2.0
language:
- en
widget:
- text: >-
You will be given a question and options. Select the right answer.
QUESTION: If (G, .) is a group such that (ab)^-1 = a^-1b^-1, for all a, b
in G, then G is a/an CHOICES: - A: commutative semi group - B: abelian
group - C: non-abelian group - D: None of these ANSWER: [unused0] [MASK]
tags:
- fill-mask
- masked-lm
- long-context
- classification
- modernbert
- mlx
pipeline_tag: fill-mask
inference: false
mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16
The Model mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16 was converted to MLX format from answerdotai/ModernBERT-Large-Instruct using mlx-lm version 0.0.3.
Use with mlx
pip install mlx-embeddings
from mlx_embeddings import load, generate
import mlx.core as mx
model, tokenizer = load("mlx-community/answerdotai-ModernBERT-Large-Instruct-bf16")
# For text embeddings
output = generate(model, processor, texts=["I like grapes", "I like fruits"])
embeddings = output.text_embeds # Normalized embeddings
# Compute dot product between normalized embeddings
similarity_matrix = mx.matmul(embeddings, embeddings.T)
print("Similarity matrix between texts:")
print(similarity_matrix)