Upload formats.py with huggingface_hub
Browse files34 unmodified lines35363738394041424344454647484938394041424344454647484950515253545556575859606151525354626364656667686934 unmodified lines
Example: when input instance: { "source": "1+1", "target": "2", "instruction": "Solve the math exercises.", "demos": [{"source": "1+2", "target": "3"}, {"source": "4-2", "target": "2"}] } is process-ed by system_format = SystemFormat( demos_field="demos", demo_format="Input: {source}\nOutput: {target}\n\n", model_input_format="Instruction: {instruction}\n\n{demos}Input: {source}\nOutput: ", )
.. code-block::
{ "source": "1+1", "target": "2", "instruction": "Solve the math exercises.", "demos": [{"source": "1+2", "target": "3"}, {"source": "4-2", "target": "2"}] }
is processed by
.. code-block::
system_format = SystemFormat( demos_field="demos", demo_format="Input: {source}\nOutput: {target}\n\n", model_input_format="Instruction: {instruction}\n\n{demos}Input: {source}\nOutput: ", )
the resulting instance is:
.. code-block::
{ "target": "2", "source": "Instruction: Solve the math exercises.\n\nInput: 1+2\nOutput: 3\n\nInput: 4-2\nOutput: 2\n\nInput: 1+1\nOutput: ", } { "target": "2", "source": "Instruction: Solve the math exercises.\n\nInput: 1+2\nOutput: 3\n\nInput: 4-2\nOutput: 2\n\nInput: 1+1\nOutput: ", }
"""
demos_field: str = "demos"formats.py+28-16