musfiqdehan commited on
Commit
11c8d12
1 Parent(s): eba49c5

Re-uploading model

Browse files
README.md CHANGED
@@ -1,3 +1,63 @@
1
  ---
2
- license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
  ---
4
+ # Bengali to English Word Aligner
5
+ Finetuned Model for **Bengali to English Word** which was build on `bert-base-multilingual-cased`
6
+
7
+ ## Quick Start
8
+ Initialize to use it in your project
9
+
10
+ ```python
11
+ tokenizer = AutoTokenizer.from_pretrained("musfiqdehan/bengali-english-word-aligner")
12
+ model = AutoModel.from_pretrained("musfiqdehan/bengali-english-word-aligner")
13
+ ```
14
+ ## Bengali-English Word Alignment
15
+
16
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1x5wUXS7vdWNeROkJS_B_lUwKTJZGaB7v?usp=sharing)
17
+
18
+ [![Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://www.kaggle.com/musfiqdehan/bengali-english-alignment-demo)
19
+
20
+ Install Dependencies
21
+ ```
22
+ !pip install -U data-preprocessors
23
+ !pip install -U bangla-postagger
24
+ ```
25
+ Import Necessary Libraries
26
+ ```python
27
+ from pprint import pprint
28
+ from data_preprocessors import text_preprocessor as tp
29
+ from bangla_postagger import (en_postaggers as ep,
30
+ bn_en_mapper as bem,
31
+ translators as trans)
32
+ ```
33
+
34
+ Testing Word Mapping and Alignment
35
+
36
+ ```python
37
+ src = "আমি ভাত খাই না, রুটি খাই।"
38
+ tgt = "I do not eat rice, I eat bread."
39
+
40
+ # Give one space before and after punctuation
41
+ # for easy tokenization
42
+ src = tp.space_punc(src)
43
+ tgt = tp.space_punc(tgt)
44
+
45
+ print("Word Mapping:")
46
+ mapping = bem.get_word_mapping(
47
+ source=src, target=tgt, model_path="musfiqdehan/bengali-english-word-aligner")
48
+ pprint(mapping)
49
+ ```
50
+
51
+ Output
52
+ ```
53
+ Word Mapping:
54
+ ['bn:(আমি) -> en:(I)',
55
+ 'bn:(ভাত) -> en:(rice)',
56
+ 'bn:(খাই) -> en:(do)',
57
+ 'bn:(খাই) -> en:(eat)',
58
+ 'bn:(না) -> en:(not)',
59
+ 'bn:(,) -> en:(,)',
60
+ 'bn:(রুটি) -> en:(bread)',
61
+ 'bn:(খাই) -> en:(eat)',
62
+ 'bn:(।) -> en:(.)']
63
+ ```
config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForMaskedLM"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": null,
7
+ "directionality": "bidi",
8
+ "do_sample": false,
9
+ "eos_token_ids": null,
10
+ "finetuning_task": null,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "LABEL_0",
16
+ "1": "LABEL_1"
17
+ },
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 3072,
20
+ "is_decoder": false,
21
+ "label2id": {
22
+ "LABEL_0": 0,
23
+ "LABEL_1": 1
24
+ },
25
+ "layer_norm_eps": 1e-12,
26
+ "length_penalty": 1.0,
27
+ "max_length": 20,
28
+ "max_position_embeddings": 512,
29
+ "model_type": "bert",
30
+ "num_attention_heads": 12,
31
+ "num_beams": 1,
32
+ "num_hidden_layers": 12,
33
+ "num_labels": 2,
34
+ "num_return_sequences": 1,
35
+ "output_attentions": false,
36
+ "output_hidden_states": false,
37
+ "output_past": true,
38
+ "pad_token_id": 0,
39
+ "pooler_fc_size": 768,
40
+ "pooler_num_attention_heads": 12,
41
+ "pooler_num_fc_layers": 3,
42
+ "pooler_size_per_head": 128,
43
+ "pooler_type": "first_token_transform",
44
+ "repetition_penalty": 1.0,
45
+ "temperature": 1.0,
46
+ "top_k": 50,
47
+ "top_p": 1.0,
48
+ "torchscript": false,
49
+ "type_vocab_size": 2,
50
+ "use_bfloat16": false,
51
+ "vocab_size": 119547
52
+ }
eval_results.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ perplexity = tensor(2.0303)
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b68156f53b7bd3ce8c9d13dac14f0762adc9029c0576b842c796f60f22f23755
3
+ size 1081597091
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": false, "max_len": 512}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c26d53ebc8dc10dcb2c2bc2ec410499a5977ef4b409dae466e5fb183b25592de
3
+ size 1711
vocab.txt ADDED
The diff for this file is too large to render. See raw diff