CoolFace
Modelpublic

zeromodels/deberta_v3_small

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes23downloads
Model Card

*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

![GitHub](https://github.com/IMvision12/ZeroModels) ![Docs](https://imvision12.github.io/ZeroModels/deberta/) ![Collection](https://huggingface.co/collections/zeromodels/deberta-v1-v2-v3-6a8eae49464403784b9d6cd0)

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)

python
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>"):

VariantHubGeneration
deberta_base`zeromodels/deberta_base`v1
deberta_large`zeromodels/deberta_large`v1
deberta_v2_xlarge`zeromodels/deberta_v2_xlarge`v2
deberta_v2_xxlarge`zeromodels/deberta_v2_xxlarge`v2
deberta_v3_xsmall`zeromodels/deberta_v3_xsmall`v3
deberta_v3_small`zeromodels/deberta_v3_small`v3
deberta_v3_base`zeromodels/deberta_v3_base`v3
deberta_v3_large`zeromodels/deberta_v3_large`v3

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).

ClassTask
DebertaV3ModelEncoder backbone
DebertaV3MaskedLMMasked language modeling (fill-mask)
DebertaV3SequenceClassifySequence classification
DebertaV3TokenClassifyToken classification (NER / POS)
DebertaV3QnAExtractive question answering
DebertaV3MultipleChoiceMultiple choice
python
from zeromodels.models.deberta_v3 import DebertaV3SequenceClassify
model = DebertaV3SequenceClassify.from_weights("zeromodels/deberta_v3_small")

Tips

  • —Set KERAS_BACKEND before 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.