Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sample new instruction pool before updating the existing function #1446

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion camel/datagen/self_instruct/self_instruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ def generate(self):
and instances.
"""
while len(self.machine_tasks) < self.num_machine_instructions:
prompt, instruction = self.generate_machine_instruction()
existing_instructions = [
t["instruction"] for t in self.human_tasks
] + [t["instruction"] for t in self.machine_tasks]
for f in self.instruction_filter.filters:
if isinstance(f, RougeSimilarityFilter):
f.existing_instructions = existing_instructions
prompt, instruction = self.generate_machine_instruction()
if self.instruction_filter.filter(prompt, instruction):
instruction_dict = {
"id": f"machine_task_{len(self.machine_tasks) + 1}",
Expand Down
26 changes: 12 additions & 14 deletions camel/datagen/self_instruct/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,20 @@ def calculate_average(numbers):
'''

input_first_template_for_gen = '''You will be given a task,
Please generate at most two example instances illustrating how to
Your job is to generate at most two example instances demonstrating how to
perform this task. For each instance:
- If the task requires input (as an actual instance of the task),
provide it. if the task itself can be answered without an instance,
skip the input.
- Then provide the correct output.
- If the task requires input (as an actual example of the task), provide it.
- If the task can be answered directly without requiring input, omit the input section.

Do not provide any additional commentary, explanations, or more than two instances. Just show the instances in the following format:
Example 1
[Input if necessary]
Output: [oldest person]
Example 2
[Input if necessary]
Output: [oldest person]
Example 1
Input: [Provide input here if needed, otherwise omit this section]
Output: [Provide the correct output]

Example 2
Input: [Provide input here if needed, otherwise omit this section]
Output: [Provide the correct output]

Do not include any additional commentary, explanations, or more than two instances.

Below are some examples:

Expand Down
Loading