-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: KyleErwin <[email protected]>
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import List | ||
|
||
from unitxt.blocks import Task | ||
from unitxt.catalog import add_to_catalog | ||
|
||
add_to_catalog( | ||
Task( | ||
input_fields={ | ||
"id": str, | ||
"utterance": str, | ||
"hint": str, | ||
"schema": List[str], | ||
}, | ||
reference_fields={"linked_schema": List[str]}, | ||
prediction_type=List[str], | ||
metrics=["metrics.f1_macro_multi_label"], | ||
), | ||
"tasks.schema_linking", | ||
overwrite=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from unitxt import add_to_catalog | ||
from unitxt.templates import InputOutputTemplate, TemplatesList | ||
|
||
add_to_catalog( | ||
InputOutputTemplate( | ||
instruction="Select the most relevant SQL columns to the given text.", | ||
input_format="Text: {utterance}\n\nColumns:{schema}", | ||
output_format="{linked_schema}", | ||
postprocessors=["processors.to_list_by_comma_space"], | ||
), | ||
"templates.schema_linking.default", | ||
overwrite=True, | ||
) | ||
|
||
add_to_catalog( | ||
InputOutputTemplate( | ||
instruction="Select the most relevant SQL columns to the given text. You are also given a hint.", | ||
input_format="Text: {utterance}\n\nHint: {hint}\n\nColumns:{schema}", | ||
output_format="{linked_schema}", | ||
postprocessors=["processors.to_list_by_comma_space"], | ||
), | ||
"templates.schema_linking.with_hint", | ||
overwrite=True, | ||
) | ||
|
||
add_to_catalog( | ||
TemplatesList( | ||
["templates.schema_linking.default", "templates.schema_linking.with_hint"] | ||
), | ||
"templates.schema_linking.all", | ||
overwrite=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"__type__": "task", | ||
"input_fields": { | ||
"id": "str", | ||
"utterance": "str", | ||
"hint": "str", | ||
"schema": "List[str]" | ||
}, | ||
"reference_fields": { | ||
"linked_schema": "List[str]" | ||
}, | ||
"prediction_type": "List[str]", | ||
"metrics": [ | ||
"metrics.f1_macro_multi_label" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"__type__": "templates_list", | ||
"items": [ | ||
"templates.schema_linking.default", | ||
"templates.schema_linking.with_hint" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"__type__": "input_output_template", | ||
"instruction": "Select the most relevant SQL columns to the given text.", | ||
"input_format": "Text: {utterance}\n\nColumns:{schema}", | ||
"output_format": "{linked_schema}", | ||
"postprocessors": [ | ||
"processors.to_list_by_comma_space" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"__type__": "input_output_template", | ||
"instruction": "Select the most relevant SQL columns to the given text. You are also given a hint.", | ||
"input_format": "Text: {utterance}\n\nHint: {hint}\n\nColumns:{schema}", | ||
"output_format": "{linked_schema}", | ||
"postprocessors": [ | ||
"processors.to_list_by_comma_space" | ||
] | ||
} |