monsoon-nlp
commited on
Commit
•
0c4cd12
1
Parent(s):
a71a824
add encoder
Browse files- README.md +39 -0
- config.json +29 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: ar
|
3 |
+
---
|
4 |
+
|
5 |
+
# ar-seq2seq-gender (encoder)
|
6 |
+
|
7 |
+
This is a seq2seq model (encoder half) to "flip" gender in **first-person** Arabic sentences.
|
8 |
+
The model can augment your existing Arabic data, or generate counterfactuals
|
9 |
+
to test a model's decisions (would changing the gender of the subject or speaker change output?).
|
10 |
+
|
11 |
+
Intended Examples:
|
12 |
+
- 'أنا سعيد' <=> 'انا سعيدة'
|
13 |
+
- 'ركض إلى المتجر' <=> 'ركضت إلى المتجر'
|
14 |
+
|
15 |
+
People's names, gender pronouns, gendered words (father, mother), and many other values are currently unchanged by this model. Future versions may be trained on more data.
|
16 |
+
|
17 |
+
## Training
|
18 |
+
|
19 |
+
I originally developed
|
20 |
+
<a href="https://github.com/MonsoonNLP/el-la">a gender flip Python script</a>
|
21 |
+
for Spanish sentences, using
|
22 |
+
<a href="https://huggingface.co/dccuchile/bert-base-spanish-wwm-uncased">BETO</a>,
|
23 |
+
and spaCy. More about this project: https://medium.com/ai-in-plain-english/gender-bias-in-spanish-bert-1f4d76780617
|
24 |
+
|
25 |
+
The Arabic model encoder and decoder started with weights and vocabulary from
|
26 |
+
<a href="https://github.com/UBC-NLP/marbert">MARBERT from UBC-NLP</a>,
|
27 |
+
and was trained on the
|
28 |
+
<a href="https://camel.abudhabi.nyu.edu/arabic-parallel-gender-corpus/">Arabic Parallel Gender Corpus</a>
|
29 |
+
from NYU Abu Dhabi. The text is first-person sentences from OpenSubtitles, with parallel
|
30 |
+
gender-reinflected sentences generated by Arabic speakers.
|
31 |
+
|
32 |
+
Training notebook: https://colab.research.google.com/drive/1TuDfnV2gQ-WsDtHkF52jbn699bk6vJZV
|
33 |
+
|
34 |
+
## Non-binary gender
|
35 |
+
|
36 |
+
This model is useful to generate male and female text samples, but falls
|
37 |
+
short of capturing gender diversity in the world and in the Arabic
|
38 |
+
language. This subject is discussed in the bias statement of the
|
39 |
+
<a href="https://www.aclweb.org/anthology/2020.gebnlp-1.12/">Gender Reinflection paper</a>.
|
config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"BertModel"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.1,
|
6 |
+
"directionality": "bidi",
|
7 |
+
"gradient_checkpointing": false,
|
8 |
+
"hidden_act": "gelu",
|
9 |
+
"hidden_dropout_prob": 0.1,
|
10 |
+
"hidden_size": 768,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 3072,
|
13 |
+
"layer_norm_eps": 1e-12,
|
14 |
+
"max_position_embeddings": 512,
|
15 |
+
"model_type": "bert",
|
16 |
+
"num_attention_heads": 12,
|
17 |
+
"num_hidden_layers": 12,
|
18 |
+
"pad_token_id": 0,
|
19 |
+
"pooler_fc_size": 768,
|
20 |
+
"pooler_num_attention_heads": 12,
|
21 |
+
"pooler_num_fc_layers": 3,
|
22 |
+
"pooler_size_per_head": 128,
|
23 |
+
"pooler_type": "first_token_transform",
|
24 |
+
"position_embedding_type": "absolute",
|
25 |
+
"transformers_version": "4.2.1",
|
26 |
+
"type_vocab_size": 2,
|
27 |
+
"use_cache": true,
|
28 |
+
"vocab_size": 100000
|
29 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c6871fa024e86bf720b7064542a727dd81a456b8f876c4aa0988b8aa2672f7e
|
3 |
+
size 651449554
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": true, "do_basic_tokenize": true, "never_split": null, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "special_tokens_map_file": null, "tokenizer_file": null}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|