-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving Transform and Rerank Module (#396)
- Loading branch information
Showing
20 changed files
with
920 additions
and
790 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
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
1 change: 0 additions & 1 deletion
1
examples/huggingface_data/huggingface_datasets/dataset_index.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
examples/huggingface_data/huggingface_datasets/reranking_dataset_index.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-7.31 MB
huggingface_data/huggingface_datasets/huggingface_datasets_datafinder_index
Binary file not shown.
297 changes: 233 additions & 64 deletions
297
prompt2model/dataset_retriever/description_dataset_retriever.py
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,26 @@ | ||
"""This module contains the functions to construct the prompt for task expansion.""" | ||
METAPROMPT_BASE = "Carefully analyse the task description and examples of the task, and explain the task to give a clearer description. Do not explain each example, but rather capture the general trends. Also place special focus on the format of the input/output examples." # noqa: E501 | ||
|
||
TASK = """ | ||
Task Description: {task_description} | ||
Task Examples: {examples} | ||
""" | ||
|
||
|
||
def construct_prompt_for_task_explanation(instruction: str, demonstrations: str): | ||
"""Constructs prompt for task explanation. | ||
This is useful for clarifying the requirements of a task, | ||
and providing a clearer description of the task. | ||
Args: | ||
instruction (str): The task instruction. | ||
demonstrations (str): The task demonstrations. | ||
Returns: | ||
str: The constructed prompt. | ||
""" | ||
task = TASK.format(task_description=instruction, examples=demonstrations) | ||
prompt = "\n--------\n".join([METAPROMPT_BASE, task]) | ||
return prompt |
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
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
Oops, something went wrong.