monsoon-nlp
commited on
Commit
•
2dfd242
1
Parent(s):
126aac0
initial commit
Browse files- README.md +36 -0
- added_tokens.json +1 -0
- config.json +40 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: ar
|
3 |
+
---
|
4 |
+
|
5 |
+
# Dialect-AR-GPT-2021
|
6 |
+
## Finetuned AraGPT-2 demo
|
7 |
+
|
8 |
+
This model started with [AraGPT2-Medium](https://huggingface.co/aubmindlab/aragpt2-medium),
|
9 |
+
from AUB MIND Lab.
|
10 |
+
|
11 |
+
This model was then finetuned on dialect datasets from Qatar University, University of British Columbia / NLP,
|
12 |
+
and Johns Hopkins University / LREC for 10 epochs.
|
13 |
+
|
14 |
+
Sources
|
15 |
+
- https://qspace.qu.edu.qa/handle/10576/15265
|
16 |
+
- https://github.com/UBC-NLP/aoc_id
|
17 |
+
- https://github.com/ryancotterell/arabic_dialect_annotation
|
18 |
+
|
19 |
+
You can use special tokens to prompt five dialects: `[EGYPTIAN]`, `[GULF]`, `[LEVANTINE]`, `[MAGHREBI]`, or `[MSA]`, followed by a space.
|
20 |
+
|
21 |
+
```
|
22 |
+
from simpletransformers.language_generation import LanguageGenerationModel
|
23 |
+
model = LanguageGenerationModel("gpt2", "monsoon-nlp/dialect-ar-gpt-2021")
|
24 |
+
model.generate('[GULF] ' + "مدينتي هي", { 'max_length': 100 })
|
25 |
+
```
|
26 |
+
|
27 |
+
There is NO content filtering in the current version; do not use for public-facing
|
28 |
+
text generation!
|
29 |
+
|
30 |
+
## Training and Finetuning details
|
31 |
+
|
32 |
+
Original model: https://huggingface.co/aubmindlab/aragpt2-medium
|
33 |
+
|
34 |
+
I inserted new tokens into the tokenizer, finetuned the model on the dialect samples, and exported the new model.
|
35 |
+
|
36 |
+
Notebook: https://colab.research.google.com/drive/19C0zbkSCt5ncVCa4kY-ik9hSEiJcjI-F
|
added_tokens.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"[EGYPTIAN]": 64000, "[MSA]": 64001, "[LEVANTINE]": 64002, "[GULF]": 64003, "[MAGHREBI]": 64004}
|
config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "aubmindlab/aragpt2-medium",
|
3 |
+
"activation_function": "gelu_new",
|
4 |
+
"architectures": [
|
5 |
+
"GPT2LMHeadModel"
|
6 |
+
],
|
7 |
+
"attn_pdrop": 0.1,
|
8 |
+
"bos_token_id": 0,
|
9 |
+
"embd_pdrop": 0.1,
|
10 |
+
"eos_token_id": 0,
|
11 |
+
"gradient_checkpointing": false,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"layer_norm_epsilon": 1e-05,
|
14 |
+
"model_type": "gpt2",
|
15 |
+
"n_ctx": 1024,
|
16 |
+
"n_embd": 1024,
|
17 |
+
"n_head": 16,
|
18 |
+
"n_inner": null,
|
19 |
+
"n_layer": 24,
|
20 |
+
"n_positions": 1024,
|
21 |
+
"resid_pdrop": 0.1,
|
22 |
+
"summary_activation": null,
|
23 |
+
"summary_first_dropout": 0.1,
|
24 |
+
"summary_proj_to_labels": true,
|
25 |
+
"summary_type": "cls_index",
|
26 |
+
"summary_use_proj": true,
|
27 |
+
"task_specific_params": {
|
28 |
+
"text-generation": {
|
29 |
+
"do_sample": true,
|
30 |
+
"max_length": 50,
|
31 |
+
"no_repeat_ngram_size": 3,
|
32 |
+
"num_beams": 5,
|
33 |
+
"repetition_penalty": 3.0,
|
34 |
+
"top_p": 0.95
|
35 |
+
}
|
36 |
+
},
|
37 |
+
"transformers_version": "4.2.2",
|
38 |
+
"use_cache": true,
|
39 |
+
"vocab_size": 64005
|
40 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2db195f4e6cd087e21715def19e516c376d2b9c5ba5e48f2905d170633a8efd0
|
3 |
+
size 1500897917
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}}
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"errors": "replace", "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": false, "special_tokens_map_file": null, "tokenizer_file": "cache_dir/984b9be0ec2b726074332b6c59e66d89049f148f96160849e6e5a9bdd7bc97b2.6ce583b24c6d3225d59bf6fb3ac34ead1e0fa04af22fb464906ee74d4c25bd77", "name_or_path": "aubmindlab/aragpt2-medium"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|