Spaces:
Build error
Build error
Commit
·
3ae54cc
1
Parent(s):
15917f6
update chatml
Browse files
src/snippets/alpaca_to_chatml.md
CHANGED
|
@@ -11,13 +11,13 @@ code: |
|
|
| 11 |
)
|
| 12 |
SELECT
|
| 13 |
[
|
| 14 |
-
struct_pack(
|
| 15 |
-
"from" := 'system',
|
| 16 |
-
"value" := instruction
|
| 17 |
-
),
|
| 18 |
struct_pack(
|
| 19 |
"from" := 'user',
|
| 20 |
-
"value" :=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
),
|
| 22 |
struct_pack(
|
| 23 |
"from" := 'assistant',
|
|
@@ -26,7 +26,6 @@ code: |
|
|
| 26 |
] AS conversation
|
| 27 |
FROM source_view
|
| 28 |
WHERE instruction IS NOT NULL
|
| 29 |
-
AND input IS NOT NULL
|
| 30 |
AND output IS NOT NULL;
|
| 31 |
---
|
| 32 |
|
|
@@ -40,13 +39,13 @@ source_view AS (
|
|
| 40 |
)
|
| 41 |
SELECT
|
| 42 |
[
|
| 43 |
-
struct_pack(
|
| 44 |
-
"from" := 'system',
|
| 45 |
-
"value" := instruction
|
| 46 |
-
),
|
| 47 |
struct_pack(
|
| 48 |
"from" := 'user',
|
| 49 |
-
"value" :=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
),
|
| 51 |
struct_pack(
|
| 52 |
"from" := 'assistant',
|
|
@@ -55,7 +54,6 @@ SELECT
|
|
| 55 |
] AS conversation
|
| 56 |
FROM source_view
|
| 57 |
WHERE instruction IS NOT NULL
|
| 58 |
-
AND input IS NOT NULL
|
| 59 |
AND output IS NOT NULL;
|
| 60 |
```
|
| 61 |
|
|
@@ -83,6 +81,6 @@ Differences between Alpaca and ChatML Conversation Format:
|
|
| 83 |
height="560px"
|
| 84 |
></iframe>
|
| 85 |
|
| 86 |
-
You can run this query through via the `sql_console` in the Hugging Face Hub [here](https://huggingface.co/datasets/yahma/alpaca-cleaned?sql_console=true&sql
|
| 87 |
|
| 88 |

|
|
|
|
| 11 |
)
|
| 12 |
SELECT
|
| 13 |
[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
struct_pack(
|
| 15 |
"from" := 'user',
|
| 16 |
+
"value" := CASE
|
| 17 |
+
WHEN input IS NOT NULL AND input != ''
|
| 18 |
+
THEN instruction || '\n' || input
|
| 19 |
+
ELSE instruction
|
| 20 |
+
END
|
| 21 |
),
|
| 22 |
struct_pack(
|
| 23 |
"from" := 'assistant',
|
|
|
|
| 26 |
] AS conversation
|
| 27 |
FROM source_view
|
| 28 |
WHERE instruction IS NOT NULL
|
|
|
|
| 29 |
AND output IS NOT NULL;
|
| 30 |
---
|
| 31 |
|
|
|
|
| 39 |
)
|
| 40 |
SELECT
|
| 41 |
[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
struct_pack(
|
| 43 |
"from" := 'user',
|
| 44 |
+
"value" := CASE
|
| 45 |
+
WHEN input IS NOT NULL AND input != ''
|
| 46 |
+
THEN instruction || '\n' || input
|
| 47 |
+
ELSE instruction
|
| 48 |
+
END
|
| 49 |
),
|
| 50 |
struct_pack(
|
| 51 |
"from" := 'assistant',
|
|
|
|
| 54 |
] AS conversation
|
| 55 |
FROM source_view
|
| 56 |
WHERE instruction IS NOT NULL
|
|
|
|
| 57 |
AND output IS NOT NULL;
|
| 58 |
```
|
| 59 |
|
|
|
|
| 81 |
height="560px"
|
| 82 |
></iframe>
|
| 83 |
|
| 84 |
+
You can run this query through via the `sql_console` in the Hugging Face Hub [here](https://huggingface.co/datasets/yahma/alpaca-cleaned?row=16&sql_console=true&sql=--+Convert+Alpaca+format+to+Conversation+format%0AWITH+%0Asource_view+AS+%28%0A++SELECT+*+FROM+train++--+Change+%27train%27+to+your+desired+view+name+here%0A%29%0ASELECT+%0A++%5B%0A++++struct_pack%28%0A++++++%22from%22+%3A%3D+%27user%27%2C%0A++++++%22value%22+%3A%3D+CASE+%0A+++++++++++++++++++WHEN+input+IS+NOT+NULL+AND+input+%21%3D+%27%27+%0A+++++++++++++++++++THEN+instruction+%7C%7C+%27%5Cn%27+%7C%7C+input%0A+++++++++++++++++++ELSE+instruction%0A+++++++++++++++++END%0A++++%29%2C%0A++++struct_pack%28%0A++++++%22from%22+%3A%3D+%27assistant%27%2C%0A++++++%22value%22+%3A%3D+output%0A++++%29%0A++%5D+AS+conversation%0AFROM+source_view%0AWHERE+instruction+IS+NOT+NULL+%0A++AND+output+IS+NOT+NULL%3B).
|
| 85 |
|
| 86 |

|
static/alpaca-to-conversation.png
CHANGED
|
|