Args:
- all_preds (Dict[str:list]): dictionary mapping task names to predictions.
Assumes that predictions are sorted (if necessary)."""
pdb.set_trace()
def write_preds_to_file(preds, pred_file, pred_map=None, write_float=False):
""" Write preds to pred_file """
with open(pred_file, "w") as pred_fh:
After Change
// convert each prediction to a single string if we find a list of tokens
if isinstance(preds[0], list):
assert isinstance(preds[0][0], str)
preds = [" ".join(pred) for pred in preds]
write_preds_to_file(preds, os.path.join(pred_dir, "%s.tsv" % task), write_type=str)
else:
write_preds_to_file(preds, os.path.join(pred_dir, "%s.tsv" % task))
log.info("Wrote predictions to %s", pred_dir)