Download pipeline.py from KBaba7/my-distiset-b569b8db: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/datasets/KBaba7/my-distiset-b569b8db/resolve/main/pipeline.py
- Command line
-
hf download hf://datasets/KBaba7/my-distiset-b569b8db/pipeline.py
-
curl -L -o pipeline.py https://huggingface.co/datasets/KBaba7/my-distiset-b569b8db/resolve/main/pipeline.py
1.33 kB
| # Requirements: `pip install distilabel[hf-inference-endpoints]` | |
| import os | |
| from distilabel.pipeline import Pipeline | |
| from distilabel.steps import KeepColumns | |
| from distilabel.steps.tasks import MagpieGenerator | |
| from distilabel.llms import InferenceEndpointsLLM | |
| SYSTEM_PROMPT = "None" | |
| with Pipeline(name="sft") as pipeline: | |
| magpie = MagpieGenerator( | |
| llm=InferenceEndpointsLLM.from_dict( | |
| {'use_magpie_template': False, 'magpie_pre_query_template': None, 'generation_kwargs': {}, 'use_offline_batch_generation': False, 'offline_batch_generation_block_until_done': None, 'jobs_ids': None, 'model_id': 'meta-llama/Llama-3.1-8B-Instruct', 'endpoint_name': None, 'endpoint_namespace': None, 'base_url': None, 'tokenizer_id': 'meta-llama/Llama-3.1-8B-Instruct', 'model_display_name': None, 'structured_output': None, 'type_info': {'module': 'distilabel.models.llms.huggingface.inference_endpoints', 'name': 'InferenceEndpointsLLM'}} | |
| ), | |
| n_turns=1, | |
| num_rows=10, | |
| batch_size=1, | |
| system_prompt=SYSTEM_PROMPT, | |
| output_mappings={'instruction': 'prompt', 'response': 'completion'}, | |
| ) | |
| keep_columns = KeepColumns( | |
| columns=['prompt', 'completion'] + ["model_name"], | |
| ) | |
| magpie.connect(keep_columns) | |
| if __name__ == "__main__": | |
| distiset = pipeline.run() |