mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
small adjustment data gen (remove empty)
This commit is contained in:
parent
f8a81a1eea
commit
1a03b01a52
4 changed files with 17 additions and 9 deletions
|
|
@ -101,14 +101,18 @@ def postprocess_qa_pairs(res_txt: str):
|
|||
has_left_over = n_gen_pairs < len(questions) or n_gen_pairs < len(answers)
|
||||
for i in range(n_gen_pairs):
|
||||
response = answers[i].strip()
|
||||
question = questions[i].strip()
|
||||
if not response or not question:
|
||||
print(f"Skipping empty question or answer at index {i}")
|
||||
continue
|
||||
if (not has_left_over) and (i == n_gen_pairs - 1):
|
||||
response, skip = check_should_skip(response, vllm_model)
|
||||
if skip:
|
||||
print(f"Skipping due to missing stop string")
|
||||
n_skips += 1
|
||||
continue
|
||||
out_q.append(questions[i].strip())
|
||||
out_a.append(answers[i].strip())
|
||||
out_q.append(question.strip())
|
||||
out_a.append(response.strip())
|
||||
print(f"Skipped {n_skips} responses due to missing stop strings")
|
||||
|
||||
return out_q, out_a
|
||||
|
|
|
|||
|
|
@ -108,14 +108,18 @@ def postprocess_qa_pairs(res_txt: str):
|
|||
has_left_over = n_gen_pairs < len(questions) or n_gen_pairs < len(answers)
|
||||
for i in range(n_gen_pairs):
|
||||
response = answers[i].strip()
|
||||
question = questions[i].strip()
|
||||
if not response or not question:
|
||||
print(f"Skipping empty question or answer at index {i}")
|
||||
continue
|
||||
if (not has_left_over) and (i == n_gen_pairs - 1):
|
||||
response, skip = check_should_skip(response, vllm_model)
|
||||
if skip:
|
||||
print(f"Skipping due to missing stop string")
|
||||
n_skips += 1
|
||||
continue
|
||||
out_q.append(questions[i].strip())
|
||||
out_a.append(answers[i].strip())
|
||||
out_q.append(question.strip())
|
||||
out_a.append(response.strip())
|
||||
print(f"Skipped {n_skips} responses due to missing stop strings")
|
||||
|
||||
return out_q, out_a
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ def self_generate(
|
|||
print("=" * 80)
|
||||
|
||||
print(f"Generated {len(samples)} samples")
|
||||
random.shuffle(samples)
|
||||
# random.shuffle(samples)
|
||||
|
||||
# Save results
|
||||
if not args.debug:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue