balhafni commited on
Commit
653ef09
1 Parent(s): dc0b443

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -2,6 +2,9 @@
2
  license: mit
3
  language:
4
  - ar
 
 
 
5
  ---
6
 
7
 
@@ -15,10 +18,32 @@ in Automatic Dialectal Text Normalization](https://arxiv.org/abs/2407.03020)."*
15
 
16
 
17
  ## Intended uses
18
- You can use the **AraT5** CODAfication model as part of Hugging Face's transformers >= 4.22.2.
19
 
20
  ## How to use
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
 
 
 
22
 
23
  ## Citation
24
  ```bibtex
 
2
  license: mit
3
  language:
4
  - ar
5
+
6
+ widget:
7
+ - text: 'اثنين همبرقر واثنين قهوة، لوسمحت. بآخذهم تيك اوي.'
8
  ---
9
 
10
 
 
18
 
19
 
20
  ## Intended uses
21
+ You can use the **AraT5 CODA** model as part of Hugging Face's transformers >= 4.22.2.
22
 
23
  ## How to use
24
+ ```python
25
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
26
+ import torch
27
+
28
+ tokenizer = AutoTokenizer.from_pretrained('CAMeL-Lab/arat5-coda')
29
+ model = AutoModelForSeq2SeqLM.from_pretrained('CAMeL-Lab/arat5-coda')
30
+
31
+ text = 'اثنين همبرقر و اثنين قهوة، لوسمحت. باخذهم تيك اواي.'
32
+
33
+ inputs = tokenizer(text, return_tensors='pt')
34
+ gen_kwargs = {'num_beams': 5, 'max_length': 200,
35
+ 'num_return_sequences': 1,
36
+ 'no_repeat_ngram_size': 0, 'early_stopping': False
37
+ }
38
+
39
+ codafied_text = model.generate(**inputs, **gen_kwargs)
40
+ codafied_text = tokenizer.batch_decode(codafied_text,
41
+ skip_special_tokens=True,
42
+ clean_up_tokenization_spaces=False)[0]
43
 
44
+ print(codafied_text)
45
+ "اثنين همبرقر واثنين قهوة، لوسمحت. بآخذهم تيك اوي."
46
+ ```
47
 
48
  ## Citation
49
  ```bibtex