Skip to content
Snippets Groups Projects
BERT.py 449 B
from loaders import get_device

class BERT:
    model_name = 'bert-base-multilingual-cased'
    def __init(self, path):
        print('Loading BERT tools…')
        self.tokenizer = BertTokenizer.from_pretrained(BERT.model_name)
        print('✔️ tokenizer')
        self.device = get_device()
        bert = BertForSequenceClassification.from_pretrained(path)
        self.model = bert.to(self.device.type)
        print('✔️ classifier')