Skip to content

Commit

Permalink
🚨other linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Oindrilla Chatterjee <[email protected]>
  • Loading branch information
oindrillac committed Jun 26, 2024
1 parent bddb6f6 commit a8ba7df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/instructlab/sdg/llmblock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Standard
from typing import Any, Dict, Union
from typing import Any, Dict
import re

# Third Party
Expand Down Expand Up @@ -86,7 +86,7 @@ def generate(self, samples, **gen_kwargs) -> Dataset:
if (num_samples is not None) and ("num_samples" not in samples.column_names):
samples = samples.add_column("num_samples", [num_samples] * len(samples))

# validate the each sample
# validate each sample
for sample in samples:
if not self._validate(self.prompt_template, sample):
return None
Expand Down Expand Up @@ -145,7 +145,7 @@ def __init__(
def _parse(self, generated_string):
if self.parser_name == "default":
return super()._parse(generated_string)
elif self.parser_name == "multi-line-logical-section":
if self.parser_name == "multi-line-logical-section":
return {
self.output_cols[0]: self.extract_multiline_logical_section(
generated_string
Expand Down Expand Up @@ -191,7 +191,7 @@ def _generate(self, samples, **gen_kwargs) -> str:
)
return [choice.text.strip() for choice in response.choices]

def _validate(self, prompt_template: str, input_dict: Dict[str, Any]) -> bool:
def _validate(self, prompt_template: str, input_dict: Dict[str, Any], extra_arg=None) -> bool:

Check warning on line 194 in src/instructlab/sdg/llmblock.py

View workflow job for this annotation

GitHub Actions / lint

W0221: Number of parameters was 2 in 'Block._validate' and is now 4 in overriding 'ConditionalLLMBlock._validate' method (arguments-differ)

Check warning on line 194 in src/instructlab/sdg/llmblock.py

View workflow job for this annotation

GitHub Actions / lint

W0613: Unused argument 'extra_arg' (unused-argument)

Check warning on line 194 in src/instructlab/sdg/llmblock.py

View workflow job for this annotation

GitHub Actions / lint

W0221: Number of parameters was 2 in 'Block._validate' and is now 4 in overriding 'ConditionalLLMBlock._validate' method (arguments-differ)

Check warning on line 194 in src/instructlab/sdg/llmblock.py

View workflow job for this annotation

GitHub Actions / lint

W0613: Unused argument 'extra_arg' (unused-argument)
if isinstance(prompt_template, dict):
prompt_template = prompt_template[input_dict[self.selector_column_name]]
return super()._validate(prompt_template, input_dict)
1 change: 1 addition & 0 deletions src/instructlab/sdg/utilblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

class SamplePopulatorBlock(Block):
def __init__(self, config_paths, column_name, post_fix="", **batch_kwargs) -> None:
super().__init__(block_name=self.__class__.__name__) # Call the base class's __init__
self.configs = {}
for config in config_paths:
if post_fix:
Expand Down

0 comments on commit a8ba7df

Please sign in to comment.