mwkim commited on
Commit
508d49d
1 Parent(s): 74a7b0e

Upload 8 files

Browse files
README.md CHANGED
@@ -1,3 +1,59 @@
1
  ---
2
- license: other
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: ko
3
+ tags:
4
+ - bert
5
+ - mrc
6
+ datasets:
7
+ - klue
8
+ license: cc-by-sa-4.0
9
  ---
10
+
11
+ # bert-base for QA
12
+
13
+ **Code:** See [Ainize Workspace](https://link.ainize.ai/3FjvBVn)
14
+
15
+ **klue-bert-base-mrc DEMO**: [Ainize DEMO](https://main-klue-mrc-bert-scy6500.endpoint.ainize.ai/)
16
+
17
+ **klue-bert-base-mrc API**: [Ainize API](https://ainize.ai/scy6500/KLUE-MRC-BERT?branch=main)
18
+
19
+ ## Overview
20
+ **Language model:** klue/bert-base
21
+ **Language:** Korean
22
+ **Downstream-task:** Extractive QA
23
+ **Training data:** KLUE-MRC
24
+ **Eval data:** KLUE-MRC
25
+
26
+
27
+
28
+ ## Usage
29
+ ### In Transformers
30
+ ```python
31
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained("ainize/klue-bert-base-mrc")
34
+ model = AutoModelForQuestionAnswering.from_pretrained("ainize/klue-bert-base-mrc")
35
+
36
+ context = "your context"
37
+ question = "your question"
38
+
39
+ encodings = tokenizer(context, question, max_length=512, truncation=True,
40
+ padding="max_length", return_token_type_ids=False)
41
+ encodings = {key: torch.tensor([val]) for key, val in encodings.items()}
42
+
43
+ input_ids = encodings["input_ids"]
44
+ attention_mask = encodings["attention_mask"]
45
+
46
+ pred = model(input_ids, attention_mask=attention_mask)
47
+
48
+ start_logits, end_logits = pred.start_logits, pred.end_logits
49
+
50
+ token_start_index, token_end_index = start_logits.argmax(dim=-1), end_logits.argmax(dim=-1)
51
+
52
+ pred_ids = input_ids[0][token_start_index: token_end_index + 1]
53
+
54
+ prediction = tokenizer.decode(pred_ids)
55
+ ```
56
+
57
+ ## About us
58
+ [Teachable NLP](https://ainize.ai/teachable-nlp) - Train NLP models with your own text without writing any code
59
+ [Ainize](https://ainize.ai/) - Deploy ML project using free gpu
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./klue_bert/",
3
+ "architectures": [
4
+ "BertForQuestionAnswering"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
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
+ "position_embedding_type": "absolute",
20
+ "transformers_version": "4.7.0",
21
+ "type_vocab_size": 2,
22
+ "use_cache": true,
23
+ "vocab_size": 32000
24
+ }
gitattributes.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
2
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.h5 filter=lfs diff=lfs merge=lfs -text
5
+ *.tflite filter=lfs diff=lfs merge=lfs -text
6
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.ot filter=lfs diff=lfs merge=lfs -text
8
+ *.onnx filter=lfs diff=lfs merge=lfs -text
9
+ *.arrow filter=lfs diff=lfs merge=lfs -text
10
+ *.ftz filter=lfs diff=lfs merge=lfs -text
11
+ *.joblib filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.pb filter=lfs diff=lfs merge=lfs -text
15
+ *.pt filter=lfs diff=lfs merge=lfs -text
16
+ *.pth filter=lfs diff=lfs merge=lfs -text
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db34d79c6062826b97b0c7c3a5028d557e7e74d1989924bee049bba144d77a26
3
+ size 440201719
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.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "do_basic_tokenize": true, "never_split": null, "model_max_length": 512, "special_tokens_map_file": "/workspace/.cache/huggingface/transformers/aeaaa3afd086a040be912f92ffe7b5f85008b744624f4517c4216bcc32b51cf0.054ece8d16bd524c8a00f0e8a976c00d5de22a755ffb79e353ee2954d9289e26", "name_or_path": "./klue_bert/"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff