File size: 1,244 Bytes
798b4b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cc6aaeb
 
 
 
 
 
 
 
 
 
798b4b4
cc6aaeb
 
798b4b4
8dc55ca
a879383
cc6aaeb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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:  # type: ignore
        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)
    # distiset.push_to_hub("distilabel-internal-testing/pipe_nothing_test", include_script=True)