diff --git a/xtuner/dataset/map_fns/dataset_map_fns/openai_map_fn.py b/xtuner/dataset/map_fns/dataset_map_fns/openai_map_fn.py index 64ed642f6..c1798dc45 100644 --- a/xtuner/dataset/map_fns/dataset_map_fns/openai_map_fn.py +++ b/xtuner/dataset/map_fns/dataset_map_fns/openai_map_fn.py @@ -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 = ''