conan1024hao commited on
Commit
00d40f3
1 Parent(s): a5c5930

support BertJapaneseTokenizer

Browse files
README.md CHANGED
@@ -1,3 +1,63 @@
1
  ---
 
2
  license: cc-by-sa-4.0
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-base-japanese
13
+
14
+ ## Model description
15
+
16
+ This is a Japanese RoBERTa base model pretrained on Japanese Wikipedia and the Japanese portion of CC-100.
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-base-japanese")
24
+ model = AutoModelForMaskedLM.from_pretrained("nlp-waseda/roberta-base-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
+ `BertJapaneseTokenizer` now supports automatic tokenization for [Juman++](https://github.com/ku-nlp/jumanpp). However, if your dataset is large, you may take a long time since `BertJapaneseTokenizer` still does not supoort fast tokenization. You can still do the Juman++ tokenization by your self and use the old model [nlp-waseda/roberta-base-japanese](https://huggingface.co/nlp-waseda/roberta-base-japanese).
36
+
37
+ Juman++ 2.0.0-rc3 was used for pretraining. Each word is tokenized into tokens by [sentencepiece](https://github.com/google/sentencepiece).
38
+
39
+ ## Vocabulary
40
+
41
+ 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).
42
+
43
+ ## Training procedure
44
+
45
+ This model was trained on Japanese Wikipedia (as of 20210920) and the Japanese portion of CC-100. It took a week using eight NVIDIA A100 GPUs.
46
+
47
+ The following hyperparameters were used during pretraining:
48
+ - learning_rate: 1e-4
49
+ - per_device_train_batch_size: 256
50
+ - distributed_type: multi-GPU
51
+ - num_devices: 8
52
+ - gradient_accumulation_steps: 2
53
+ - total_train_batch_size: 4096
54
+ - max_seq_length: 128
55
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
56
+ - lr_scheduler_type: linear
57
+ - training_steps: 700000
58
+ - warmup_steps: 10000
59
+ - mixed_precision_training: Native AMP
60
+
61
+ ## Performance on JGLUE
62
+
63
+ See the [Baseline Scores](https://github.com/yahoojapan/JGLUE#baseline-scores) of JGLUE.
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": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "roberta",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.12.5",
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:b26a40bee61b7ab95739d7a0839e29a66cba82343b509bd4008e49d7577e9c77
3
+ size 442692523
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": true}}
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,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_lower_case": false,
3
+ "remove_space": true,
4
+ "keep_accents": true,
5
+ "bos_token": "[CLS]",
6
+ "eos_token": "[SEP]",
7
+ "unk_token": "[UNK]",
8
+ "sep_token": "[SEP]",
9
+ "pad_token": "[PAD]",
10
+ "cls_token": "[CLS]",
11
+ "mask_token": {
12
+ "content": "[MASK]",
13
+ "single_word": false,
14
+ "lstrip": true,
15
+ "rstrip": false,
16
+ "normalized": true,
17
+ "__type": "AddedToken"
18
+ },
19
+ "sp_model_kwargs": {},
20
+ "special_tokens_map_file": null,
21
+ "tokenizer_class": "BertJapaneseTokenizer",
22
+ "word_tokenizer_type": "jumanpp",
23
+ "subword_tokenizer_type": "wordpiece",
24
+ "jumanpp_kwargs": {}
25
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff