Skip to content

Commit

Permalink
🖋️ Fix warning message formatting in KTOTrainer (#2394)
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec authored Nov 26, 2024
1 parent bbd8cbb commit baee06f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions trl/trainer/kto_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,12 +729,12 @@ def make_inputs_require_grad(module, input, output):

if not (des_weight_in_range or und_weight_in_range):
warnings.warn(
f"""
You have different amounts of desirable/positive and undesirable/negative examples but the
weights on the desirable and undesirable losses don't seem to be in an ideal range. Based
on your data, we recommend EITHER desirable_weight in [{des_weight_lower_bound}, {des_weight_upper_bound}]
or undesirable_weight in [{und_weight_lower_bound}, {und_weight_upper_bound}] (but NOT BOTH).
See the documentation on how to optimally set these weights.""",
"You have different amounts of desirable/positive and undesirable/negative examples but the "
"weights on the desirable and undesirable losses don't seem to be in an ideal range. Based "
f"on your data, we recommend EITHER "
f"desirable_weight in [{des_weight_lower_bound}, {des_weight_upper_bound}] or "
f"undesirable_weight in [{und_weight_lower_bound}, {und_weight_upper_bound}] (but NOT BOTH). "
"See the documentation on how to optimally set these weights.",
UserWarning,
)

Expand Down

0 comments on commit baee06f

Please sign in to comment.