Commit
·
2c30a68
1
Parent(s):
9e3a804
initial release
Browse files- README.md +40 -0
- config.json +31 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- spm.model +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- "japanese"
|
| 4 |
+
- "question-answering"
|
| 5 |
+
- "dependency-parsing"
|
| 6 |
+
datasets:
|
| 7 |
+
- "universal_dependencies"
|
| 8 |
+
license: "cc-by-sa-4.0"
|
| 9 |
+
pipeline_tag: "question-answering"
|
| 10 |
+
widget:
|
| 11 |
+
- text: "国語"
|
| 12 |
+
context: "全学年にわたって小学校の国語の教科書に挿し絵が用いられている"
|
| 13 |
+
- text: "教科書"
|
| 14 |
+
context: "全学年にわたって小学校の国語の教科書に挿し絵が用いられている"
|
| 15 |
+
- text: "の"
|
| 16 |
+
context: "全学年にわたって小学校の国語[MASK]教科書に挿し絵が用いられている"
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# deberta-base-japanese-aozora-ud-head
|
| 20 |
+
|
| 21 |
+
## Model Description
|
| 22 |
+
|
| 23 |
+
This is a DeBERTa(V2) model pretrained on 青空文庫 for dependency-parsing (head-detection on long-unit-words) as question-answering, derived from [deberta-base-japanese-aozora](https://huggingface.co/KoichiYasuoka/deberta-base-japanese-aozora) and [UD_Japanese-GSDLUW](https://huggingface.co/UniversalDependencies/UD_Japanese-GSDLUW). Use [MASK] inside `context` to avoid ambiguity when specifing a multiple-used word as `question`.
|
| 24 |
+
|
| 25 |
+
## How to Use
|
| 26 |
+
|
| 27 |
+
```py
|
| 28 |
+
import torch
|
| 29 |
+
from transformers import AutoTokenizer,AutoModelForQuestionAnswering
|
| 30 |
+
tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/deberta-base-japanese-aozora-ud-head")
|
| 31 |
+
model=AutoModelForQuestionAnswering.from_pretrained("KoichiYasuoka/deberta-base-japanese-aozora-ud-head")
|
| 32 |
+
question="国語"
|
| 33 |
+
context="全学年にわたって小学校の国語の教科書に挿し絵が用いられている"
|
| 34 |
+
inputs=tokenizer(question,context,return_tensors="pt",return_offsets_mapping=True)
|
| 35 |
+
offsets=inputs.pop("offset_mapping").tolist()[0]
|
| 36 |
+
outputs=model(**inputs)
|
| 37 |
+
start,end=torch.argmax(outputs.start_logits),torch.argmax(outputs.end_logits)
|
| 38 |
+
print(context[offsets[start][0]:offsets[end][-1]])
|
| 39 |
+
```
|
| 40 |
+
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"DebertaV2ForQuestionAnswering"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"eos_token_id": 2,
|
| 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-07,
|
| 14 |
+
"max_position_embeddings": 512,
|
| 15 |
+
"max_relative_positions": -1,
|
| 16 |
+
"model_type": "deberta-v2",
|
| 17 |
+
"num_attention_heads": 12,
|
| 18 |
+
"num_hidden_layers": 12,
|
| 19 |
+
"pad_token_id": 1,
|
| 20 |
+
"pooler_dropout": 0,
|
| 21 |
+
"pooler_hidden_act": "gelu",
|
| 22 |
+
"pooler_hidden_size": 768,
|
| 23 |
+
"pos_att_type": null,
|
| 24 |
+
"position_biased_input": true,
|
| 25 |
+
"relative_attention": false,
|
| 26 |
+
"tokenizer_class": "DebertaV2TokenizerFast",
|
| 27 |
+
"torch_dtype": "float32",
|
| 28 |
+
"transformers_version": "4.19.4",
|
| 29 |
+
"type_vocab_size": 0,
|
| 30 |
+
"vocab_size": 32000
|
| 31 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7509e3bc46e732e2b4cada2976207b7f735ace7e6be5262a7424c0cc010e2415
|
| 3 |
+
size 440178035
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
|
| 3 |
+
size 1
|
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, "bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "split_by_punct": true, "keep_accents": true, "model_max_length": 512, "tokenizer_class": "DebertaV2TokenizerFast"}
|