Skip to content

Commit

Permalink
Fix kto (modelscope#1737)
Browse files Browse the repository at this point in the history
* fix

* fix
  • Loading branch information
hjh0119 authored Aug 17, 2024
1 parent 250d0d8 commit 3081069
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion swift/trainers/kto_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def encode_batch(batch: Dict[str, List[Any]], template: Template):
response=r,
round0=i)
template._concat_context_list(template.prompt, res_context_list, compute_loss_idx, query=query, round0=len(history))
res_context_list, compute_loss_idx = template._simplify_context_list(res_context_list, compute_loss_idx)
res_context_list, compute_loss_idx = template._simplify_context_list(
res_context_list, compute_loss_idx, example=batch)
prompt = ''.join(res_context_list)

return {'prompt': prompt, 'completion': batch['response'], 'label': batch['label']}
Expand Down

0 comments on commit 3081069

Please sign in to comment.