def test_dacoreg(self): dacoref = Dacoref() corpus = dacoref.load_as_conllu(predefined_splits=True) self.assertEqual(len(corpus), 3) self.assertEqual( len(corpus[0]) + len(corpus[1]) + len(corpus[2]), 3403) self.assertEqual(corpus[0][0][0]['form'], 'På')
import time from utils import print_speed_performance from danlp.datasets import Dacoref from danlp.models import load_xlmr_coref_model import os # load the data dacoref = Dacoref() _, _, testset = dacoref.load_as_conllu(predefined_splits=True) num_sentences = len(testset) num_tokens = sum([len(s) for s in testset]) def benchmark_xlmr_mdl(): from allennlp.data import DataLoader from allennlp.training.util import evaluate xlmr = load_xlmr_coref_model() data_loader_params = xlmr.config.pop("data_loader") instances = xlmr.dataset_reader.load_dataset(testset) instances.index_with(xlmr.model.vocab) data_loader = DataLoader.from_params(dataset=instances, params=data_loader_params) start = time.time()