def __init__(self): self._tokenizer = load_bert_tokenizer('data') self._device = torch.device( 'cuda:0' if torch.cuda.is_available() else 'cpu') self._batch_collector = _get_batch_collector(self._device, is_train=False) self._model = BertClassifier(init_bert('data/'), output_name='label').to(self._device)
def __init__(self, data_path='data'): self._model = BertMulticlassClassifier( init_bert(data_path), class_count=len(_ERRORS), output_name='error_type' ) self._tokenizer = load_bert_tokenizer(data_path) self.morph = pymorphy2.MorphAnalyzer() use_cuda = torch.cuda.is_available() self._device = torch.device('cuda:0' if use_cuda else 'cpu') self._batch_collector = _get_batch_collector(self._device, is_train=False)
def __init__(self, seed=42, bert_path="data/models/bert/rubert/qbic"): self.seed = seed self.init_seed() self.is_loaded = False self.bert_path = bert_path self._tokenizer = load_bert_tokenizer(self.bert_path) self._device = torch.device( "cuda:0" if torch.cuda.is_available() else "cpu") self._batch_collector = _get_batch_collector(self._device, is_train=False) self._model = RubertClassifier(init_bert(self.bert_path), output_name="label").to(self._device)
def __init__(self, seed=42, bert_path="data/models/bert/rubert/qbic"): self.is_loaded = False self.bert_path = bert_path self._model = RubertMulticlassClassifier( init_bert(self.bert_path), class_count=len(_ERRORS), output_name="error_type", ) self._tokenizer = load_bert_tokenizer(self.bert_path) self.morph = pymorphy2.MorphAnalyzer() self.seed = seed self.init_seed() use_cuda = torch.cuda.is_available() self._device = torch.device("cuda:0" if use_cuda else "cpu") self._batch_collector = _get_batch_collector(self._device, is_train=False)