Views
No views yet

BertTokenizer instead of BigBirdTokenizer. (AutoTokenizer will load BertTokenizer)1from transformers import AutoModel, AutoTokenizer
2
3# by default its in `block_sparse` mode with num_random_blocks=3, block_size=64
4model = AutoModel.from_pretrained("monologg/kobigbird-bert-base")
5
6# you can change `attention_type` to full attention like this:
7model = AutoModel.from_pretrained("monologg/kobigbird-bert-base", attention_type="original_full")
8
9# you can change `block_size` & `num_random_blocks` like this:
10model = AutoModel.from_pretrained("monologg/kobigbird-bert-base", block_size=16, num_random_blocks=2)
11
12tokenizer = AutoTokenizer.from_pretrained("monologg/kobigbird-bert-base")
13text = "한국어 BigBird 모델을 공개합니다!"
14encoded_input = tokenizer(text, return_tensors='pt')
15output = model(**encoded_input)