Instructions to use zeromodels/deberta_v3_small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/deberta_v3_small with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use zeromodels/deberta_v3_small with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/deberta_v3_small") - Notebooks
- Google Colab
- Kaggle
fix readme.md
Browse files
README.md
CHANGED
|
@@ -1,30 +1,83 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: mit
|
| 3 |
-
|
| 4 |
-
|
| 5 |
tags:
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
---
|
| 17 |
-
# DeBERTa-v3 (deberta_v3_small)
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
```python
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
pipeline_tag: fill-mask
|
| 3 |
license: mit
|
| 4 |
+
base_model: microsoft/deberta-v3-small
|
| 5 |
+
library_name: kerasformers
|
| 6 |
tags:
|
| 7 |
+
- keras
|
| 8 |
+
- kerasformers
|
| 9 |
+
- deberta
|
| 10 |
+
- deberta-v3
|
| 11 |
+
- fill-mask
|
| 12 |
+
- text-encoder
|
| 13 |
+
- arxiv:2006.03654
|
| 14 |
+
- arxiv:2111.09543
|
| 15 |
+
- pytorch
|
| 16 |
+
- jax
|
| 17 |
+
- tf
|
| 18 |
---
|
|
|
|
| 19 |
|
| 20 |
+
## ***See [our collection](https://huggingface.co/collections/kerasformers/deberta-v1-v2-v3-6a6e90bac01e412b478562f3) for all versions of DeBERTa (v1 / v2 / v3).***
|
| 21 |
|
| 22 |
+
# Run DeBERTa with Keras 3: JAX, PyTorch, or TensorFlow
|
| 23 |
|
| 24 |
+
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/deberta/) [](https://huggingface.co/collections/kerasformers/deberta-v1-v2-v3-6a6e90bac01e412b478562f3)
|
| 25 |
+
|
| 26 |
+
# kerasformers/deberta_v3_small
|
| 27 |
+
|
| 28 |
+
Papers: [DeBERTa: Decoding-enhanced BERT with Disentangled Attention (arXiv:2006.03654)](https://arxiv.org/abs/2006.03654) · [DeBERTaV3 (arXiv:2111.09543)](https://arxiv.org/abs/2111.09543) · [HF Papers](https://huggingface.co/papers/2006.03654)
|
| 29 |
+
|
| 30 |
+
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.
|
| 31 |
+
|
| 32 |
+
For more details on the model, please go to the upstream [model card](https://huggingface.co/microsoft/deberta-v3-small).
|
| 33 |
+
|
| 34 |
+
Pure-**Keras 3** conversion of [`microsoft/deberta-v3-small`](https://huggingface.co/microsoft/deberta-v3-small) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
| 35 |
+
|
| 36 |
+
This is a **fill-mask / encoder** checkpoint (`DebertaV3MaskedLM`, v3 small). Task heads (sequence/token classify, QA, …) load via `hf:` fine-tunes.
|
| 37 |
+
|
| 38 |
+
## ✨ Quick start (fill-mask)
|
| 39 |
|
| 40 |
```python
|
| 41 |
+
import os
|
| 42 |
+
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
| 43 |
+
|
| 44 |
+
from kerasformers.models.deberta_v3 import (
|
| 45 |
+
DebertaV3MaskedLM,
|
| 46 |
+
DebertaV3Tokenizer,
|
| 47 |
+
)
|
| 48 |
|
| 49 |
+
mlm = DebertaV3MaskedLM.from_weights("kerasformers/deberta_v3_small")
|
| 50 |
+
tokenizer = DebertaV3Tokenizer.from_weights("kerasformers/deberta_v3_small")
|
| 51 |
+
|
| 52 |
+
inputs = tokenizer("The capital of France is [MASK].")
|
| 53 |
+
logits = mlm(inputs) # (1, L, vocab_size)
|
| 54 |
+
mask = int((inputs["input_ids"][0] == tokenizer.mask_token_id).argmax())
|
| 55 |
+
print(tokenizer.decode([int(logits[0, mask].argmax())]))
|
| 56 |
```
|
| 57 |
|
| 58 |
+
Load any DeBERTa variant the same way with `from_weights("kerasformers/<variant>")`:
|
| 59 |
+
|
| 60 |
+
| Variant | Hub | Generation |
|
| 61 |
+
|---|---|---|
|
| 62 |
+
| `deberta_base` | [`kerasformers/deberta_base`](https://huggingface.co/kerasformers/deberta_base) | v1 |
|
| 63 |
+
| `deberta_large` | [`kerasformers/deberta_large`](https://huggingface.co/kerasformers/deberta_large) | v1 |
|
| 64 |
+
| `deberta_v2_xlarge` | [`kerasformers/deberta_v2_xlarge`](https://huggingface.co/kerasformers/deberta_v2_xlarge) | v2 |
|
| 65 |
+
| `deberta_v2_xxlarge` | [`kerasformers/deberta_v2_xxlarge`](https://huggingface.co/kerasformers/deberta_v2_xxlarge) | v2 |
|
| 66 |
+
| `deberta_v3_xsmall` | [`kerasformers/deberta_v3_xsmall`](https://huggingface.co/kerasformers/deberta_v3_xsmall) | v3 |
|
| 67 |
+
| `deberta_v3_small` | [`kerasformers/deberta_v3_small`](https://huggingface.co/kerasformers/deberta_v3_small) | v3 |
|
| 68 |
+
| `deberta_v3_base` | [`kerasformers/deberta_v3_base`](https://huggingface.co/kerasformers/deberta_v3_base) | v3 |
|
| 69 |
+
| `deberta_v3_large` | [`kerasformers/deberta_v3_large`](https://huggingface.co/kerasformers/deberta_v3_large) | v3 |
|
| 70 |
+
|
| 71 |
+
## Tips
|
| 72 |
+
|
| 73 |
+
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 74 |
+
- Prefer `Tokenizer.from_weights(...)` so vocab and mask token match.
|
| 75 |
+
- Do not mix packages across generations (v1 ≠ v2 ≠ v3).
|
| 76 |
+
- See [DeBERTa docs](https://imvision12.github.io/KerasFormers/deberta/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 77 |
+
- Community / upstream safetensors still work via the `hf:` prefix, e.g. `DebertaV3MaskedLM.from_weights("hf:microsoft/deberta-v3-small")`.
|
| 78 |
+
|
| 79 |
+
## Special Thanks
|
| 80 |
+
|
| 81 |
+
A huge thank you to the Microsoft DeBERTa authors for creating and releasing these models.
|
| 82 |
+
|
| 83 |
+
License: MIT.
|