| import time |
| from typing import List |
| from distilabel.pipeline import Pipeline |
| from distilabel.steps import LoadDataFromDicts |
|
|
| from distilabel.steps import StepInput, step |
| from distilabel.steps.base import Step, StepInput |
| from distilabel.steps.typing import StepOutput |
|
|
| class DummyStep(Step): |
| @property |
| def inputs(self) -> List[str]: |
| return ["instruction"] |
| @property |
| def outputs(self) -> List[str]: |
| return ["response"] |
| def process(self, inputs: StepInput) -> StepOutput: |
| for input in inputs: |
| input["response"] = "unit test" |
| yield inputs |
|
|
|
|
| @step() |
| def InfiniteStep(*inputs: StepInput) -> StepOutput: |
| time.sleep(1) |
| yield [{"instruction": ["nothing"]}] |
|
|
|
|
| with Pipeline(name="pipe-nothing") as pipeline: |
| load_dataset = LoadDataFromDicts( |
| data=[ |
| {"instruction": "Tell me a joke."}, |
| ] * 2, |
| batch_size=2 |
| ) |
|
|
| dummy = DummyStep(name="DUMMY_STEP") |
| load_dataset >> dummy |
|
|
|
|
| if __name__ == "__main__": |
|
|
| distiset = pipeline.run(use_cache=False) |
| distiset.push_to_hub("plaguss/pipe_nothing_test", include_script=True) |
| |
|
|