Initial release.
Browse files- README.md +55 -0
- config.json +26 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- spiece.model +3 -0
- tokenizer_config.json +1 -0
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: ja
|
| 3 |
+
license: cc-by-sa-4.0
|
| 4 |
+
datasets:
|
| 5 |
+
- wikipedia
|
| 6 |
+
- cc100
|
| 7 |
+
mask_token: "[MASK]"
|
| 8 |
+
widget:
|
| 9 |
+
- text: "早稲田 大学 で 自然 言語 処理 を [MASK] する 。"
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# nlp-waseda/roberta-large-japanese
|
| 13 |
+
|
| 14 |
+
## Model description
|
| 15 |
+
|
| 16 |
+
This is a Japanese RoBERTa large model pretrained on Japanese Wikipedia and the Japanese portion of CC-100 with the maximum sequence length of 512.
|
| 17 |
+
|
| 18 |
+
## How to use
|
| 19 |
+
|
| 20 |
+
You can use this model for masked language modeling as follows:
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 23 |
+
tokenizer = AutoTokenizer.from_pretrained("nlp-waseda/roberta-large-japanese")
|
| 24 |
+
model = AutoModelForMaskedLM.from_pretrained("nlp-waseda/roberta-large-japanese")
|
| 25 |
+
|
| 26 |
+
sentence = '早稲田 大学 で 自然 言語 処理 を [MASK] する 。' # input should be segmented into words by Juman++ in advance
|
| 27 |
+
encoding = tokenizer(sentence, return_tensors='pt')
|
| 28 |
+
...
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
You can fine-tune this model on downstream tasks.
|
| 32 |
+
|
| 33 |
+
## Tokenization
|
| 34 |
+
|
| 35 |
+
The input text should be segmented into words by [Juman++](https://github.com/ku-nlp/jumanpp) in advance. Juman++ 2.0.0-rc3 was used for pretraining. Each word is tokenized into tokens by [sentencepiece](https://github.com/google/sentencepiece).
|
| 36 |
+
|
| 37 |
+
## Vocabulary
|
| 38 |
+
|
| 39 |
+
The vocabulary consists of 32000 tokens including words ([JumanDIC](https://github.com/ku-nlp/JumanDIC)) and subwords induced by the unigram language model of [sentencepiece](https://github.com/google/sentencepiece).
|
| 40 |
+
|
| 41 |
+
## Training procedure
|
| 42 |
+
|
| 43 |
+
This model was trained on Japanese Wikipedia (as of 20210920) and the Japanese portion of CC-100 from the checkpoint of [nlp-waseda/roberta-large-japanese](https://huggingface.co/nlp-waseda/roberta-large-japanese). It took a week using eight NVIDIA A100 GPUs.
|
| 44 |
+
|
| 45 |
+
The following hyperparameters were used during pretraining:
|
| 46 |
+
- learning_rate: 6e-5
|
| 47 |
+
- distributed_type: multi-GPU
|
| 48 |
+
- num_devices: 8
|
| 49 |
+
- total_train_batch_size: 4120 (max_seq_length=128), 4032 (max_seq_length=512)
|
| 50 |
+
- max_seq_length: 512
|
| 51 |
+
- optimizer: Adam with betas=(0.9,0.98) and epsilon=1e-6
|
| 52 |
+
- lr_scheduler_type: linear
|
| 53 |
+
- training_steps: 670000 (max_seq_length=128) + 70000 (max_seq_length=512)
|
| 54 |
+
- warmup_steps: 10000
|
| 55 |
+
- mixed_precision_training: Native AMP
|
config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"RobertaForMaskedLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 2,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"eos_token_id": 3,
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.1,
|
| 11 |
+
"hidden_size": 1024,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 4096,
|
| 14 |
+
"layer_norm_eps": 1e-12,
|
| 15 |
+
"max_position_embeddings": 514,
|
| 16 |
+
"model_type": "roberta",
|
| 17 |
+
"num_attention_heads": 16,
|
| 18 |
+
"num_hidden_layers": 24,
|
| 19 |
+
"pad_token_id": 0,
|
| 20 |
+
"position_embedding_type": "absolute",
|
| 21 |
+
"torch_dtype": "float32",
|
| 22 |
+
"transformers_version": "4.18.0",
|
| 23 |
+
"type_vocab_size": 2,
|
| 24 |
+
"use_cache": true,
|
| 25 |
+
"vocab_size": 32000
|
| 26 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06f4bafed9d4cc7e44d0f0714db18f9396e8410e842927b8305b05aee0cfdfeb
|
| 3 |
+
size 1346903275
|
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": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
|
spiece.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7f87f538d8c73fb0a6a34efb7ba6e3488f920341119c02c208bce7965cf248e
|
| 3 |
+
size 810161
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": false, "remove_space": true, "keep_accents": true, "bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false, "__type": "AddedToken"}, "sp_model_kwargs": {}, "special_tokens_map_file": null, "tokenizer_class": "AlbertTokenizer"}
|