def _run_crossencoder(crossencoder, dataloader, logger, context_len, device="cuda"): crossencoder.model.eval() accuracy = 0.0 crossencoder.to(device) res = evaluate(crossencoder, dataloader, device, logger, context_len, zeshel=False, silent=False) accuracy = res["normalized_accuracy"] logits = res["logits"] if accuracy > -1: predictions = np.argsort(logits, axis=1) else: predictions = [] return accuracy, predictions, logits
def _run_crossencoder(crossencoder, dataloader, logger, context_len, device="cpu"): crossencoder.model.eval() accuracy = 0.0 crossencoder.to(device) res = evaluate(crossencoder, dataloader, device, logger, context_len, silent=True) accuracy = res["normalized_accuracy"] logits = res["logits"] predictions = np.argsort(logits, axis=1) return accuracy, predictions, logits