ModernBert
Collection
16 items โข Updated โข 2
Run mlx-community/answerdotai-ModernBERT-base-8bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/mlx-community/answerdotai-ModernBERT-base-8bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/mlx-community/answerdotai-ModernBERT-base-8bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use mlx-community/answerdotai-ModernBERT-base-8bit with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("fill-mask", model="mlx-community/answerdotai-ModernBERT-base-8bit") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("mlx-community/answerdotai-ModernBERT-base-8bit")
model = AutoModelForMaskedLM.from_pretrained("mlx-community/answerdotai-ModernBERT-base-8bit", device_map="auto")How to use mlx-community/answerdotai-ModernBERT-base-8bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download mlx-community/answerdotai-ModernBERT-base-8bit --local-dir answerdotai-ModernBERT-base-8bit
The Model mlx-community/answerdotai-ModernBERT-base-8bit was converted to MLX format from answerdotai/ModernBERT-base using mlx-lm version 0.0.3.
pip install mlx-embeddings
from mlx_embeddings import load, generate
import mlx.core as mx
model, tokenizer = load("mlx-community/answerdotai-ModernBERT-base-8bit")
# 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)
Quantized