def evaluate(cfg: Config, nlp: TorchLanguage, val_data: InputData) -> Dict: try: scores = nlp.evaluate(val_data, batch_size=cfg.nbatch * 2) except Exception: report_fail(val_data) raise return scores
def test(nlp: TorchLanguage, data): if torch.cuda.is_available(): nlp.to(torch.device("cuda")) nlp.evaluate(data, batch_size=256)