zeromodels/deberta_v3_small
*See [our collection](https://huggingface.co/collections/zeromodels/deberta-v1-v2-v3-6a8eae49464403784b9d6cd0) for all versions of DeBERTa (v1 / v2 / v3).*
Run DeBERTa with Keras 3: JAX, PyTorch, or TensorFlow
  
zeromodels/debertav3small
Papers: DeBERTa: Decoding-enhanced BERT with Disentangled Attention (arXiv:2006.03654) · DeBERTaV3 (arXiv:2111.09543) · HF Papers
DeBERTa is Microsoft's disentangled-attention text encoder (content + relative position). v1 uses byte-level BPE; v2/v3 use SentencePiece. v3 adds ELECTRA-style pretraining with gradient-disentangled embedding sharing. Import from deberta / deberta_v2 / deberta_v3 to match the generation.
For more details on the model, please go to the upstream model card.
Pure-Keras 3 conversion of `microsoft/deberta-v3-small` for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.
This is a fill-mask / encoder checkpoint (DebertaV3MaskedLM, v3 small). Task heads (sequence/token classify, QA, …) load via hf: fine-tunes.
✨ Quick start (fill-mask)
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from zeromodels.models.deberta_v3 import (
DebertaV3MaskedLM,
DebertaV3Tokenizer,
)
mlm = DebertaV3MaskedLM.from_weights("zeromodels/deberta_v3_small")
tokenizer = DebertaV3Tokenizer.from_weights("zeromodels/deberta_v3_small")
inputs = tokenizer("The capital of France is [MASK].")
logits = mlm(inputs) # (1, L, vocab_size)
mask = int((inputs["input_ids"][0] == tokenizer.mask_token_id).argmax())
print(tokenizer.decode([int(logits[0, mask].argmax())]))Load any DeBERTa variant the same way with from_weights("zeromodels/<variant>"):
Available classes
Load any of these from this repo with from_weights("zeromodels/deberta_v3_small") (or on the fly via the hf: prefix). The pretrained backbone is shared; task heads not stored in this checkpoint start randomly initialized, ready for fine-tuning (or load a hf: fine-tune).
from zeromodels.models.deberta_v3 import DebertaV3SequenceClassify
model = DebertaV3SequenceClassify.from_weights("zeromodels/deberta_v3_small")Tips
- Set
KERAS_BACKENDbefore importing Keras / zeromodels. - Prefer
Tokenizer.from_weights(...)so vocab and mask token match. - Do not mix packages across generations (v1 ≠ v2 ≠ v3).
- See DeBERTa docs and Loading Weights.
- Community / upstream safetensors still work via the
hf:prefix, e.g.DebertaV3MaskedLM.from_weights("hf:microsoft/deberta-v3-small").
Special Thanks
A huge thank you to the Microsoft DeBERTa authors for creating and releasing these models.
License: MIT.
