Lowin commited on
Commit
0888f68
•
1 Parent(s): 035a32b
Files changed (4) hide show
  1. README.md +28 -0
  2. config.json +30 -0
  3. pytorch_model.bin +3 -0
  4. vocab.txt +0 -0
README.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ license:
5
+ - apache-2.0
6
+ ---
7
+ ```python
8
+ import jieba_fast
9
+ from transformers import BertTokenizer
10
+ from transformers import BigBirdModel
11
+ class JiebaTokenizer(BertTokenizer):
12
+ def __init__(
13
+ self, pre_tokenizer=lambda x: jieba_fast.cut(x, HMM=False), *args, **kwargs
14
+ ):
15
+ super().__init__(*args, **kwargs)
16
+ self.pre_tokenizer = pre_tokenizer
17
+ def _tokenize(self, text, *arg, **kwargs):
18
+ split_tokens = []
19
+ for text in self.pre_tokenizer(text):
20
+ if text in self.vocab:
21
+ split_tokens.append(text)
22
+ else:
23
+ split_tokens.extend(super()._tokenize(text))
24
+ return split_tokens
25
+ model = BigBirdModel.from_pretrained('Lowin/chinese-bigbird-base')
26
+ tokenizer = JiebaTokenizer.from_pretrained('Lowin/chinese-bigbird-base')
27
+ ```
28
+ https://github.com/LowinLi/chinese-bigbird
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BigBirdForMaskedLM"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "attention_type": "block_sparse",
7
+ "block_size": 64,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu_fast",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-12,
17
+ "max_position_embeddings": 4096,
18
+ "model_type": "big_bird",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "num_random_blocks": 3,
22
+ "pad_token_id": 0,
23
+ "rescale_embeddings": false,
24
+ "sep_token_id": 66,
25
+ "transformers_version": "4.6.1",
26
+ "type_vocab_size": 2,
27
+ "use_bias": true,
28
+ "use_cache": true,
29
+ "vocab_size": 40000
30
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ecfad0fa352402146a2d62a81c8b2bb13bdaee1b093099b835290e0a5700bd71
3
+ size 480701374
vocab.txt ADDED
The diff for this file is too large to render. See raw diff