fix: generation_N.jsonl candidate_id format mismatch vs filenames (#669)
This commit is contained in:
parent
0aa819f168
commit
b6c07b1d93
1 changed files with 5 additions and 7 deletions
|
|
@ -762,7 +762,7 @@ for fname in sorted(os.listdir(output_dir)):
|
|||
if not (fname.startswith('generation_') and fname.endswith('.jsonl')):
|
||||
continue
|
||||
try:
|
||||
int(fname[len('generation_'):-len('.jsonl')]) # validate integer suffix
|
||||
gen_idx = int(fname[len('generation_'):-len('.jsonl')]) # validate integer suffix
|
||||
except ValueError:
|
||||
continue
|
||||
with open(os.path.join(output_dir, fname)) as f:
|
||||
|
|
@ -773,13 +773,11 @@ for fname in sorted(os.listdir(output_dir)):
|
|||
fitness = int(d.get('fitness', 0))
|
||||
if fitness < threshold:
|
||||
continue
|
||||
# cid format: "gen{N}_c{MMM}"
|
||||
if not cid.startswith('gen') or '_c' not in cid:
|
||||
# cid format: "candidate_XXX" (gen_idx derived from enclosing filename)
|
||||
if not cid.startswith('candidate_'):
|
||||
continue
|
||||
after_gen = cid[3:] # strip "gen"
|
||||
gen_str, cand_str = after_gen.split('_c', 1)
|
||||
gen_idx = int(gen_str)
|
||||
push3_path = os.path.join(
|
||||
cand_str = cid[len('candidate_'):] # numeric suffix, e.g. "001"
|
||||
push3_path = os.path.join(
|
||||
work_dir, f'gen_{gen_idx}',
|
||||
f'candidate_{int(cand_str):03d}.push3'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue