dgx-harness-engineering / 09_self_improving_loop.py
koreallmdev's picture
Upload anonymized DGX harness engineering export V1.4
b62c338 verified
Raw
History Blame Contribute Delete
813 Bytes
from best_of_n_generator import generate_n
from best_selector import select_best
import json
DATASET = []
PROMPTS = [
"LRU ์บ์‹œ ๊ตฌํ˜„",
"๋‹ค์ต์ŠคํŠธ๋ผ ์„ค๋ช…",
"FastAPI ์„œ๋ฒ„ ์„ค๊ณ„",
"Redis ๊ตฌ์กฐ"
]
for epoch in range(3):
new_data = []
for p in PROMPTS:
# 1. N๊ฐœ ์ƒ์„ฑ
samples = generate_n(p, n=5)
# 2. best ์„ ํƒ
best = select_best(samples)
new_data.append({
"instruction": p,
"output": best
})
# 3. ๋ฐ์ดํ„ฐ ๋ˆ„์ 
DATASET += new_data
print(f"Epoch {epoch} complete:", len(DATASET))
# ์ €์žฅ
with open("dataset_final.jsonl", "w", encoding="utf-8") as f:
for d in DATASET:
f.write(json.dumps(d, ensure_ascii=False) + "\n")
print("[DONE] self-improving dataset ready")