The implementation of log method in KTOTrainer uses wrong prefix eval/ instead of eval_ (similar with train metrics).
This results in names of metrics not being properly processed by logging callbacks (I tested on WandbCallback). The problem is specifically with function rewrite_logs, which expects correct prefixes. This results in metric names in wandb like train/train/rewards/margins or train/eval/rewards/margins (see picture below). If you would like I can submit a pull request for this issue since the fix should be pretty trivial?
def rewrite_logs(d):
new_d = {}
eval_prefix = "eval_"
eval_prefix_len = len(eval_prefix)
test_prefix = "test_"
test_prefix_len = len(test_prefix)
for k, v in d.items():
if k.startswith(eval_prefix):
new_d["eval/" + k[eval_prefix_len:]] = v
elif k.startswith(test_prefix):
new_d["test/" + k[test_prefix_len:]] = v
else:
new_d["train/" + k] = v
return new_d

The implementation of log method in
KTOTraineruses wrong prefixeval/instead ofeval_(similar with train metrics).This results in names of metrics not being properly processed by logging callbacks (I tested on
WandbCallback). The problem is specifically with function rewrite_logs, which expects correct prefixes. This results in metric names in wandb liketrain/train/rewards/marginsortrain/eval/rewards/margins(see picture below). If you would like I can submit a pull request for this issue since the fix should be pretty trivial?