Skip to content

Commit

Permalink
fixing linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Abhi.B <[email protected]>
  • Loading branch information
Abhi.B authored and Abhi.B committed Jun 27, 2024
1 parent 87746ec commit abf8598
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/instructlab/sdg/llmblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ def __init__(
def _parse(self, generated_string) -> dict:
matches = {}


if self.parser_name is not None and self.parser_name == 'custom':
if self.parser_name is not None and self.parser_name == "custom":
pattern = re.compile(self.parsing_pattern, re.DOTALL)
all_matches = pattern.findall(generated_string)
matches = {column_name: [] for column_name in self.output_cols}
Expand All @@ -63,15 +62,14 @@ def _parse(self, generated_string) -> dict:
matches[column_name].append(value)
else:
matches[self.output_cols[0]] = (
[match.strip() for match in all_matches] if all_matches else []
)
[match.strip() for match in all_matches] if all_matches else []
)
else:
for start_tag, end_tag, output_col in zip(
self.block_config["start_tags"],
self.block_config["end_tags"],
self.output_cols,
):

if not start_tag and not end_tag:
matches[output_col] = (
generated_string.strip() if generated_string else None
Expand Down Expand Up @@ -165,7 +163,6 @@ def __init__(
**self._load_config(config)
)


def _generate(self, samples, **gen_kwargs) -> str:
if isinstance(self.prompt_template, dict):
prompts = [
Expand Down

0 comments on commit abf8598

Please sign in to comment.