File size: 847 Bytes
aabab56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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.")