DistilBERT-NER
dslim's DistilBERT fine-tuned on CoNLL-2003 for named-entity recognition, exported for loom.cpp. Family 12: text in, one class per token out.
This is a loom.cpp export: a single self-describing GGUF that carries its own graph topologies, tokenizer (if any) and driver script, produced by loom-exporter.
Original model
Exported from dslim/distilbert-NER. Weights are unmodified; this repo packages the same parameters into
loom.cpp's GGUF format.
License
apache-2.0, inherited from the base model above.
Language(s)
en
Usage
Run it with loom-py -- loom-py-rt on PyPI:
pip install -U "loom-py-rt[hub]"
import loom
model = loom.Model.from_pretrained("loom-ai-org/distilbert-ner-loom")
result = model.text2class.infer("My name is Wolfgang and I live in Berlin")
print(result.text)
# My/O name/O is/O Wolfgang/B-PER and/O I/O live/O in/O Berlin/B-LOC
# The labels come back beside the PIECES the tokenizer produced, not the words you wrote -- a
# WordPiece encode splits unknown and long words, so "Wolfgang" may be one piece here and three in
# another sentence. Joining them back into words is a rule only you can make, which is why both
# halves are handed over rather than one.
for token in result:
print(token.piece, token.label)
# Every class this checkpoint can choose between, in the order its ids run:
print(result.labels)
# The framing tokens the encode adds ([CLS] and [SEP]) are dropped for you, on the ids the file
# declares rather than on their spelling. Ask for the raw alignment if you want them:
raw = model.text2class.infer("My name is Wolfgang and I live in Berlin", strip_special=False)
print(len(raw), "rows including [CLS] and [SEP], against", len(result), "without")
The layer underneath
The call above is the high-level door: one per task, named for the modality pair it maps between, with
the windowing, sampling and assembly this model needs already applied. Under it, model.infer(...)
passes your arguments straight to the driver this GGUF embeds -- which is where you go for a knob the
door does not name.
model.driver_source prints that driver, including a header comment documenting every argument it
accepts for this model, and is the authority on it. See loom-py for the API and
loom.cpp for what the engine does between the two.
Known limitations
Trained on CoNLL-2003, which is newswire from 1996-1997 -- entity names that did not exist then, and text that does not read like a news wire, are outside what it saw. It recognises four types (PER, ORG, LOC, MISC) and nothing else, and it is cased: lowercasing your input before passing it costs real accuracy, because capitalisation is most of what a NER model has to go on.
The labels line up with the tokenizer's PIECES, not with your words. A word the vocabulary splits gets one label per piece, and they can disagree -- deciding which one wins is the caller's rule, which is why the export hands back the pieces alongside the labels rather than a list of words.
The export takes one sequence at a time and no padding, so there is no batch dimension to fill and no attention mask to pass. Sequences are capped at 512 tokens by the checkpoint's own learned position table.
Files
distilbert-ner.gguf-- the model, exported with loom-exporter.
- Downloads last month
- 27
We're not able to determine the quantization variants.