Update README.md
Browse files
README.md
CHANGED
@@ -7,7 +7,37 @@ thumbnail: https://huggingface.co/front/thumbnails/microsoft.png
|
|
7 |
license: mit
|
8 |
---
|
9 |
|
10 |
-
## DeBERTa: Decoding-enhanced BERT with Disentangled Attention
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
[DeBERTa](https://arxiv.org/abs/2006.03654) improves the BERT and RoBERTa models using disentangled attention and enhanced mask decoder. It outperforms BERT and RoBERTa on majority of NLU tasks with 80GB training data.
|
13 |
|
|
|
7 |
license: mit
|
8 |
---
|
9 |
|
10 |
+
## DeBERTa-fixed: Decoding-enhanced BERT with Disentangled Attention
|
11 |
+
|
12 |
+
### Example code
|
13 |
+
|
14 |
+
```python
|
15 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
16 |
+
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained("ltg/deberta-xxlarge-fixed", trust_remote_code=True)
|
18 |
+
model = AutoModelForCausalLM.from_pretrained("ltg/deberta-xxlarge-fixed", trust_remote_code=True).cuda().eval()
|
19 |
+
|
20 |
+
prompt = """German: Hallo, wie geht es Ihnen heute?
|
21 |
+
English:"""
|
22 |
+
prompt = prompt.replace('\n', '\\n ')
|
23 |
+
input_ids = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).input_ids.cuda()
|
24 |
+
|
25 |
+
prediction = model.generate(
|
26 |
+
input_ids,
|
27 |
+
num_beams=4,
|
28 |
+
do_sample=False,
|
29 |
+
use_cache=None,
|
30 |
+
max_new_tokens=64,
|
31 |
+
eos_token_id=tokenizer(".\\", add_special_tokens=False).input_ids[1:]
|
32 |
+
)
|
33 |
+
prediction = prediction[0, input_ids.size(1):]
|
34 |
+
prediction = tokenizer.decode(prediction).rstrip('\\')
|
35 |
+
|
36 |
+
# Expected output: "Hello, how are you doing today?"
|
37 |
+
print(prediction)
|
38 |
+
```
|
39 |
+
|
40 |
+
## Old README below:
|
41 |
|
42 |
[DeBERTa](https://arxiv.org/abs/2006.03654) improves the BERT and RoBERTa models using disentangled attention and enhanced mask decoder. It outperforms BERT and RoBERTa on majority of NLU tasks with 80GB training data.
|
43 |
|