Spaces:
No application file
No application file
| from transformers import pipeline | |
| import json | |
| generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct", tokenizer="mistralai/Mistral-7B-Instruct") | |
| seed_prompts = [ | |
| "Dame 10 preguntas filosóficas con respuestas profundas.", | |
| "Genera 5 ejemplos tipo ChatGPT con tono sarcástico pero sabio.", | |
| "Crea 10 instrucciones para IA educativa con respuestas creativas." | |
| ] | |
| output = [] | |
| for prompt in seed_prompts: | |
| result = generator(prompt, max_new_tokens=512)[0]["generated_text"] | |
| # ¡Aquí puedes separar y limpiar! Por ahora simplificamos | |
| output.append({"instruction": prompt, "response": result}) | |
| with open("instruct_dataset.jsonl", "w", encoding="utf-8") as f: | |
| for example in output: | |
| f.write(json.dumps(example, ensure_ascii=False) + "\n") | |
| print("✅ Dataset generado.") | |