File size: 364 Bytes
5bb6ad4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

from transformers import AutoTokenizer
import os


class Tokenizer:
    
    def __init__(self) -> None:
        
        self.tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", hf_token = '...')

        self.tokenizer.add_special_tokens({'pad_token': '[PAD]'})

    def ready_tokenizer(self):
        
        return self.tokenizer