Skip to content

Commit c0eb695

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1e7cb5c commit c0eb695

File tree

12 files changed

+45
-46
lines changed

12 files changed

+45
-46
lines changed

examples/arena_hard.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
import re
1616
from typing import Any, Dict, List, Optional, Union
1717

18+
from distilabel.steps.tasks.typing import ChatType
19+
from distilabel.steps.typing import StepOutput
1820
from typing_extensions import override
1921

2022
from distilabel.steps import GlobalStep, StepInput
2123
from distilabel.steps.tasks.base import Task
22-
from distilabel.steps.tasks.typing import ChatType
23-
from distilabel.steps.typing import StepOutput
2424

2525

2626
class ArenaHard(Task):
@@ -331,6 +331,8 @@ def process(self, inputs: StepInput) -> StepOutput: # type: ignore
331331
if __name__ == "__main__":
332332
import json
333333

334+
from distilabel.steps.typing import StepOutput
335+
334336
from distilabel.models import InferenceEndpointsLLM, OpenAILLM
335337
from distilabel.pipeline import Pipeline
336338
from distilabel.steps import (
@@ -341,7 +343,6 @@ def process(self, inputs: StepInput) -> StepOutput: # type: ignore
341343
step,
342344
)
343345
from distilabel.steps.tasks import TextGeneration
344-
from distilabel.steps.typing import StepOutput
345346

346347
@step(inputs=["turns"], outputs=["system_prompt", "instruction"])
347348
def PrepareForTextGeneration(*inputs: StepInput) -> StepOutput:

examples/deepseek_prover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from textwrap import dedent
1818
from typing import Any, Dict, List, Optional, Union
1919

20+
from distilabel.steps.tasks.typing import ChatType
2021
from jinja2 import Template
2122
from pydantic import PrivateAttr
2223
from typing_extensions import override
@@ -25,7 +26,6 @@
2526
from distilabel.pipeline import Pipeline
2627
from distilabel.steps import LoadDataFromHub
2728
from distilabel.steps.tasks.base import Task
28-
from distilabel.steps.tasks.typing import ChatType
2929

3030
_PARSE_DEEPSEEK_PROVER_AUTOFORMAL_REGEX = r"```lean4(.*?)```"
3131

src/distilabel/distiset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ def load_from_disk(
509509
)
510510
dest_distiset_path = distiset_path
511511

512-
assert fs.isdir(
513-
original_distiset_path
514-
), "`distiset_path` must be a `PathLike` object pointing to a folder or a URI of a remote filesystem."
512+
assert fs.isdir(original_distiset_path), (
513+
"`distiset_path` must be a `PathLike` object pointing to a folder or a URI of a remote filesystem."
514+
)
515515

516516
has_config = False
517517
has_artifacts = False

src/distilabel/pipeline/batch_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ def from_step(
231231
input_batch_size=getattr(step, "input_batch_size", None),
232232
data={predecessor: [] for predecessor in predecessors},
233233
convergence_step=convergence_step,
234-
next_expected_seq_no={predecessor: (0, 0) for predecessor in predecessors},
234+
next_expected_seq_no=dict.fromkeys(predecessors, (0, 0)),
235235
step_signature=step.signature,
236236
use_cache=step.use_cache,
237-
step_offset={predecessor: (0, 0) for predecessor in predecessors},
237+
step_offset=dict.fromkeys(predecessors, (0, 0)),
238238
)
239239

240240
def _get_seq_no(self) -> int:

src/distilabel/pipeline/write_buffer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ def __init__(
6565
step: [] for step in leaf_steps
6666
}
6767
# TODO: make this configurable
68-
self._buffers_dump_batch_size: Dict[str, int] = {
69-
step: 50 for step in leaf_steps
70-
}
68+
self._buffers_dump_batch_size: Dict[str, int] = dict.fromkeys(leaf_steps, 50)
7169
self._buffer_last_schema = {}
72-
self._buffers_last_file: Dict[str, int] = {step: 1 for step in leaf_steps}
70+
self._buffers_last_file: Dict[str, int] = dict.fromkeys(leaf_steps, 1)
7371
self._steps_cached = steps_cached or {}
7472
self._logger = logging.getLogger("distilabel.write_buffer")
7573

src/distilabel/steps/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _infer_step_name(
101101
base_name = "_".join(parts[:-1])
102102
while name in step_names:
103103
idx = int(name.split("_")[-1])
104-
name = f"{base_name}_{idx+1}"
104+
name = f"{base_name}_{idx + 1}"
105105
return name
106106

107107

src/distilabel/steps/tasks/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _output_on_failure(
211211
a new field `distilabel_meta` with the raw output of the LLM.
212212
"""
213213
# Create a dictionary with the outputs of the task (every output set to None)
214-
outputs = {output: None for output in self.outputs}
214+
outputs = dict.fromkeys(self.outputs)
215215
outputs["model_name"] = self.llm.model_name # type: ignore
216216
outputs = self._create_metadata(
217217
outputs,

src/distilabel/steps/tasks/improving_text_embeddings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def format_output(
6666
A Python dictionary with the parsed output based on the `keys` property.
6767
"""
6868
if output is None:
69-
return {key: None for key in self.keys}
69+
return dict.fromkeys(self.keys)
7070

7171
def escape_backslashes_in_values(s):
7272
# Regular expression to match the key-value pairs in the dictionary
@@ -100,7 +100,7 @@ def replace_backslashes(match):
100100
pass
101101

102102
if not isinstance(output, dict):
103-
return {key: None for key in self.keys}
103+
return dict.fromkeys(self.keys)
104104

105105
return {key: output.get(key, None) for key in self.keys}
106106

src/distilabel/steps/tasks/math_shepherd/completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def _auto_label(
485485
self._logger.info("Completer failed due to empty completion")
486486
continue
487487
if completion[-1] == golden_answers[instruction_i]:
488-
label = f" { self.tags[0]}"
488+
label = f" {self.tags[0]}"
489489
# If we found one, it's enough as we are doing Hard Estimation
490490
continue
491491
# In case we had no solutions from the previous step, otherwise we would have

src/distilabel/steps/tasks/text_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def unload(self) -> None:
229229
@property
230230
def inputs(self) -> "StepColumns":
231231
"""The input for the task is the `instruction` by default, or the `columns` given as input."""
232-
columns = {column: True for column in self.columns}
232+
columns = dict.fromkeys(self.columns, True)
233233
columns["system_prompt"] = False
234234
return columns
235235

0 commit comments

Comments
 (0)