Skip to content

Commit

Permalink
finetuning prompt for better sample generation
Browse files Browse the repository at this point in the history
  • Loading branch information
stolzenp committed Apr 18, 2024
1 parent 2f8e85f commit b0cacde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/fabricator/prompts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def get_prompt_text(self, labels: Union[str, List[str]] = None, examples: Option
if examples:
# due to small_model training fewshot_examples appear after some iterations
if self.relevant_columns_for_fewshot_examples is None:
self.relevant_columns_for_fewshot_examples = examples.column_names
self.relevant_columns_for_fewshot_examples = ['text']
self.fewshot_prompt = self.inner_fewshot_example_separator.join(
[f"{var}: {{{var}}}" for var in self.relevant_columns_for_fewshot_examples]
[f"{{{var}}}" for var in self.relevant_columns_for_fewshot_examples]
)
examples = self.filter_examples_by_columns(examples, self.relevant_columns_for_fewshot_examples)
formatted_examples = [self.fewshot_prompt.format(**example) for example in examples]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
label_options = ["positive", "negative"]

prompt = BasePrompt(
task_description="Generate a {} movie review.",
task_description="You are writing a movie review. Write only one {} movie review similar to the following examples.",
label_options=label_options,
target_formatting_template="",
)

prompt_node = PromptNode(
model_name_or_path="mistralai/Mistral-7B-Instruct-v0.1",
max_length=100,
max_length=500,
model_kwargs={"temperature": 0.9},

)

generator = DatasetGenerator(prompt_node)
Expand Down

0 comments on commit b0cacde

Please sign in to comment.