同步代码更新 (2026-06-16)
- 移除 generate_diverse_answers.py(多样化回答已废止) - 更新 generate_fresh_qa.py(目标50万条新问答) - 更新 generate_multiturn.py(6~12轮长对话,目标50万) - 更新 regenerate_all_high_temp.py(独立保存,不追加训练集) - 更新 .gitignore(忽略新输出目录) - 所有API Key改为环境变量读取
This commit is contained in:
1 parent
eb1d62f85c
commit
91db488ad4
5 files changed
+21
-291
No files matched your search
@@ -111,30 +111,12 @@ def main():
|
||||
print(f"生成结果: {len(all_results)} 条 (去重后)")
|
||||
print(f"用时: {(time.time() - t_start)/60:.1f} 分钟")
|
||||
|
||||
# 5. 追加到训练集
|
||||
for tgt in ['xiaoli_train_v2.json', 'xiaoli_merged_data_v2.json']:
|
||||
tp = os.path.join(MODEL_DIR, tgt)
|
||||
print(f"\n追加到 {tgt}...")
|
||||
with open(tp, encoding='utf-8') as f:
|
||||
cur = json.load(f)
|
||||
|
||||
# 去重
|
||||
ex = set((it.get('question', '')[:100], it.get('answer', '')[:100]) for it in cur)
|
||||
to_add = []
|
||||
for r in all_results:
|
||||
key = (r['question'][:100], r['answer'][:100])
|
||||
if key not in ex:
|
||||
ex.add(key)
|
||||
to_add.append({'question': r['question'], 'answer': r['answer']})
|
||||
|
||||
cur.extend(to_add)
|
||||
with open(tp, 'w', encoding='utf-8') as f:
|
||||
json.dump(cur, f, ensure_ascii=False, indent=2)
|
||||
|
||||
if 'train' in tgt:
|
||||
print(f" ✅ 训练集 +{len(to_add)} 条 → {len(cur)} 条")
|
||||
else:
|
||||
print(f" ✅ 合并集 +{len(to_add)} 条 → {len(cur)} 条")
|
||||
# 5. 保存最终去重结果(独立存放,不追加到训练集)
|
||||
final_file = os.path.join('/data/user/work', 'high_temp_final.json')
|
||||
with open(final_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(all_results, f, ensure_ascii=False, indent=2)
|
||||
print(f"\n最终结果已保存: {final_file}")
|
||||
print(f"如需使用,可手动合并到训练集")
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print(f"全部完成! 新增 {len(all_results)} 条多样化回答")
|
||||
|
||||
Reference in new issue
Block a user