Upload formats.py with huggingface_hub
Browse files- formats.py +28 -16
formats.py
CHANGED
@@ -35,23 +35,35 @@ class SystemFormat(Format):
|
|
35 |
|
36 |
Example:
|
37 |
when input instance:
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
the resulting instance is:
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
"""
|
56 |
|
57 |
demos_field: str = "demos"
|
|
|
35 |
|
36 |
Example:
|
37 |
when input instance:
|
38 |
+
|
39 |
+
.. code-block::
|
40 |
+
|
41 |
+
{
|
42 |
+
"source": "1+1",
|
43 |
+
"target": "2",
|
44 |
+
"instruction": "Solve the math exercises.",
|
45 |
+
"demos": [{"source": "1+2", "target": "3"}, {"source": "4-2", "target": "2"}]
|
46 |
+
}
|
47 |
+
|
48 |
+
is processed by
|
49 |
+
|
50 |
+
.. code-block::
|
51 |
+
|
52 |
+
system_format = SystemFormat(
|
53 |
+
demos_field="demos",
|
54 |
+
demo_format="Input: {source}\nOutput: {target}\n\n",
|
55 |
+
model_input_format="Instruction: {instruction}\n\n{demos}Input: {source}\nOutput: ",
|
56 |
+
)
|
57 |
+
|
58 |
the resulting instance is:
|
59 |
+
|
60 |
+
.. code-block::
|
61 |
+
|
62 |
+
{
|
63 |
+
"target": "2",
|
64 |
+
"source": "Instruction: Solve the math exercises.\n\nInput: 1+2\nOutput: 3\n\nInput: 4-2\nOutput: 2\n\nInput: 1+1\nOutput: ",
|
65 |
+
}
|
66 |
+
|
67 |
"""
|
68 |
|
69 |
demos_field: str = "demos"
|