anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Predicts masked words in English text and gives you a pre-trained encoder with a 32K context to fine-tune for classification or retrieval. A fill-mask model from dmis-lab for ML engineers and researchers.
UltraBERT-380M is a kit in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page, a zip of its files. Nothing in it runs by itself.
pip install -U huggingface_hub hf download dmis-lab/UltraBERT-380M
UltraBERT-380M is an English bidirectional encoder from dmis-lab, published as a fill-mask model for the transformers library. It reads inputs up to 32K tokens natively. Its authors say it takes the top scores on classification and on retrieval together, where earlier encoders of its size led in only one of the two.
Machine learning engineers who fine-tune encoders for classification or search, and researchers who compare encoders. The weights carry the Apache 2.0 license.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Search | Retrieval engineers | Fine-tune it with mean pooling and a contrastive loss for dense retrieval | Training a retriever on their own passage pairs |
| Language technology | Classification teams | Fine-tune it with a classification head on labeled text | Adding a two-label head to sort short messages |
| Research | Encoder researchers | Test how an encoder behaves on long inputs | Running a passkey-style test at long context lengths |
Anyone who wants a model that writes text can skip it, since this one fills in masked words and encodes text.
| Use case | Who | What they get back |
|---|---|---|
| Fill a masked word | Developers | The word the model scores highest for the gap |
| Classification | ML engineers | A fine-tuned model that sorts text into labels |
| Dense retrieval | Search teams | A fine-tuned retriever built on mean pooling |
pip install -U huggingface_hub hf download dmis-lab/UltraBERT-380M
The card's first example loads the tokenizer and the masked-language model, builds a sentence with a mask token in it, and prints the word the model picks for the gap.
import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer
model_id = "dmis-lab/UltraBERT-380M"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
attn_implementation="flash_attention_2", # or "sdpa"
device_map="cuda",
)
text = f"The capital of France is {tokenizer.mask_token}."
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
logits = model(**inputs).logits
mask_index = (inputs.input_ids == tokenizer.mask_token_id).nonzero()[0, 1]
print(tokenizer.decode(logits[0, mask_index].argmax()))For fine-tuning, the same checkpoint loads into the usual task classes.
from transformers import AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained(
"dmis-lab/UltraBERT-380M", num_labels=2
)The authors suggest starting from the settings in their paper. They also warn that learning rates should be set well below the usual encoder values, sometimes ten times lower. On MNLI the best rate they report for this model is 8e-6, and for dense retrieval it is 3e-5.
| Tool | What it does |
|---|---|
| AutoTokenizer | Turns text into tokens and supplies the mask token |
| AutoModelForMaskedLM | Loads the model to predict a masked word |
| AutoModelForSequenceClassification | Loads it with a classification head for fine-tuning |
You write the sentence "The capital of France is" followed by the mask token and run the card's first snippet. It prints the one word the model rates highest for that gap.
Fill mask means the model guesses a hidden word in a sentence. A good first step is to run the card's first snippet and watch what it prints for the gap.
Underneath, every pre-training batch holds sequences with 5% of tokens hidden and others with 50% hidden, and a separate output head serves each share. Light hiding helps classification and heavy hiding helps retrieval, according to the card, and separate heads keep the two from interfering. Training ran at 2K tokens before the context grew to 32K. The 380M size comes from cutting the width of a 1.3B encoder, with distillation from that teacher.
Predicts masked words in English text and gives you a pre-trained encoder with a 32K context to fine-tune for classification or retrieval. A fill-mask model from dmis-lab for ML engineers and researchers.
Made by dmis-lab on Hugging Face. These notes are Mindket's, written from its model page and model card; the model's own files and license are on Hugging Face.
What it is: UltraBERT-380M is an English bidirectional encoder from dmis-lab, published as a fill-mask model for the transformers library. It reads inputs up to 32K tokens natively. Its authors say it takes the top scores on classification and on retrieval together, where earlier encoders of its size led in only one of the two.
Who it suits: Machine learning engineers who fine-tune encoders for classification or search, and researchers who compare encoders. The weights carry the Apache 2.0 license.
Industry | Who uses it | How they use it | Example
Search | Retrieval engineers | Fine-tune it with mean pooling and a contrastive loss for dense retrieval | Training a retriever on their own passage pairs
Language technology | Classification teams | Fine-tune it with a classification head on labeled text | Adding a two-label head to sort short messages
Research | Encoder researchers | Test how an encoder behaves on long inputs | Running a passkey-style test at long context lengths
Anyone who wants a model that writes text can skip it, since this one fills in masked words and encodes text.
Where to use it:
Use case | Who | What they get back
Fill a masked word | Developers | The word the model scores highest for the gap
Classification | ML engineers | A fine-tuned model that sorts text into labels
Dense retrieval | Search teams | A fine-tuned retriever built on mean pooling
How to set it up:
pip install -U huggingface_hub
hf download dmis-lab/UltraBERT-380M
How to use it: The card's first example loads the tokenizer and the masked-language model, builds a sentence with a mask token in it, and prints the word the model picks for the gap.
import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer
model_id = "dmis-lab/UltraBERT-380M"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
attn_implementation="flash_attention_2", # or "sdpa"
device_map="cuda",
)
text = f"The capital of France is {tokenizer.mask_token}."
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
logits = model(**inputs).logits
mask_index = (inputs.input_ids == tokenizer.mask_token_id).nonzero()[0, 1]
print(tokenizer.decode(logits[0, mask_index].argmax()))
For fine-tuning, the same checkpoint loads into the usual task classes.
from transformers import AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained(
"dmis-lab/UltraBERT-380M", num_labels=2
)
The authors suggest starting from the settings in their paper. They also warn that learning rates should be set well below the usual encoder values, sometimes ten times lower. On MNLI the best rate they report for this model is 8e-6, and for dense retrieval it is 3e-5.
Tool | What it does
AutoTokenizer | Turns text into tokens and supplies the mask token
AutoModelForMaskedLM | Loads the model to predict a masked word
AutoModelForSequenceClassification | Loads it with a classification head for fine-tuning
Example: You write the sentence "The capital of France is" followed by the mask token and run the card's first snippet. It prints the one word the model rates highest for that gap.
For newcomers and experts: Fill mask means the model guesses a hidden word in a sentence. A good first step is to run the card's first snippet and watch what it prints for the gap.
Underneath, every pre-training batch holds sequences with 5% of tokens hidden and others with 50% hidden, and a separate output head serves each share. Light hiding helps classification and heavy hiding helps retrieval, according to the card, and separate heads keep the two from interfering. Training ran at 2K tokens before the context grew to 32K. The 380M size comes from cutting the width of a 1.3B encoder, with distillation from that teacher.
Pre-train at 2K tokens
Mask at 5% and 50% with two heads
Prune the 1.3B encoder and distill it
Extend the context to 32K
Fine-tune for classification or retrieval
Good to know:
Download its files with Hugging Face's command line:
pip install -U huggingface_hub
hf download dmis-lab/UltraBERT-380M
Then follow the usage in its model card. Nothing in this kit runs by itself.
README.md 6 KB
Listed Hugging Face models in the same category that share the most tags with this one.
| Product | Downloads, last 30 days | Likes | Parameters | License | Last change |
|---|---|---|---|---|---|
| UltraBERT-380M This page | 15,830 | 82 | 430M | apache-2.0 | |
| UltraGliClass v0.1Shares ultrabert · long-context · safetensors | 59 | 4 | 154M | apache-2.0 | |
| ModernBERT-baseShares fill-mask · long-context · transformers | 2,939,636 | 1,155 | 150M | apache-2.0 | |
| ModernBERT-largeShares fill-mask · long-context · transformers | 572,085 | 504 | 396M | apache-2.0 | |
| UltraBERT-150M-clairic-extractionShares ultrabert · transformers · safetensors | 138 | 5 | 151M | apache-2.0 | |
| FRIDA-DecisionsShares encoder · safetensors | 1,111 | 57 | 823M | mit |
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
alirezarezvani · Skill
Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…
block · Kit
Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…
backnotprop · Kit
Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.