Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ritugala committed Apr 18, 2024
1 parent 95dcea0 commit b92dca2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion prompt2model/dataset_transformer/prompt_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def transform_data(
Returns:
A tuple containing two lists: inputs and outputs.
"""

task_explanation = self.generate_task_explanation(prompt_spec)
self.plan = self.generate_plan(task_explanation, dataset, prompt_spec)
logger.info(f"Plan created. Plan: {self.plan}")
Expand Down
1 change: 0 additions & 1 deletion prompt2model/utils/api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def generate_one_completion(
An OpenAI-like response object if there were no errors in generation.
In case of API-specific error, Exception object is captured and returned.
"""
breakpoint()
num_prompt_tokens = count_tokens_from_string(prompt)
if self.max_tokens:
max_tokens = self.max_tokens - num_prompt_tokens - token_buffer
Expand Down
15 changes: 7 additions & 8 deletions tests/dataset_transformer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
)
@patch(
"prompt2model.utils.APIAgent.generate_one_completion",
side_effect=[TASK_EXPLANATION,PLAN_RESPONSE],
side_effect=[TASK_EXPLANATION, PLAN_RESPONSE],
)
def test_transform_data(mock_batch_completion, mock_one_completion):
"""Test transform_data."""
dataset_transformer = PromptBasedDatasetTransformer(num_points_to_transform=1, max_allowed_failed_transforms=0) # noqa: E501
dataset_transformer = PromptBasedDatasetTransformer(
num_points_to_transform=1, max_allowed_failed_transforms=0
) # noqa: E501
prompt_spec = MockPromptSpec(
TaskType.TEXT_GENERATION,
instruction="instruction",
Expand All @@ -56,11 +58,8 @@ def test_transform_data(mock_batch_completion, mock_one_completion):
inputs, outputs = dataset_transformer.transform_data(
prompt_spec=prompt_spec,
dataset=dataset["train"],

)
breakpoint()
assert (
inputs
== ["context: Albany, the state capital, is the sixth-largest city in the State of New York.\nquestion: What is the capital of New York?"] # noqa E501
)
assert inputs == [
"context: Albany, the state capital, is the sixth-largest city in the State of New York.\nquestion: What is the capital of New York?" # noqa E501
] # noqa E501
assert outputs == ["Albany"]

0 comments on commit b92dca2

Please sign in to comment.