Skip to content

Commit

Permalink
[Feature] support output without loss in openai_map_fn (#816)
Browse files Browse the repository at this point in the history
support output without loss in openai_map_fn
  • Loading branch information
HIT-cwh authored Jul 9, 2024
1 parent 7575f2c commit 8adc8d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xtuner/dataset/map_fns/dataset_map_fns/openai_map_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def openai_map_fn(example):
elif msg['role'] == 'user':
input += msg['content']
elif msg['role'] == 'assistant':
output_with_loss = msg.get('loss', True)
output_with_loss = output_with_loss.lower() == 'true'
conversation.append({
'system': system,
'input': input,
'output': msg['content']
'output': msg['content'],
'output_with_loss': output_with_loss
})
system = ''
input = ''
Expand Down

0 comments on commit 8adc8d4

Please sign in to comment.