lsdf commited on
Commit
b42a56b
·
1 Parent(s): 6b11536

fix(optimizer): define _emit before first call (avoid UnboundLocalError)

Browse files
Files changed (1) hide show
  1. optimizer.py +9 -9
optimizer.py CHANGED
@@ -1330,15 +1330,6 @@ def optimize_text(
1330
  ngram_step_addon = min(56, max(0, ngram_row_count) * NGRAM_ATTEMPTS_PER_TERM)
1331
  total_loop_steps = min(80, max_iterations + ngram_step_addon)
1332
 
1333
- _emit("preparing", message="Подготовка", phase="baseline")
1334
- _emit(
1335
- "started",
1336
- total_steps=total_loop_steps,
1337
- max_iterations_setting=max_iterations,
1338
- ngram_targets=ngram_row_count,
1339
- stages_order=list(STAGE_ORDER),
1340
- )
1341
-
1342
  current_text = target_text
1343
  current_analysis = baseline_analysis
1344
  current_semantic = baseline_semantic
@@ -1371,6 +1362,15 @@ def optimize_text(
1371
  "stop_reason": stop_reason,
1372
  }
1373
 
 
 
 
 
 
 
 
 
 
1374
  seen_candidate_rewrites = set()
1375
  cascade_level = 1
1376
  consecutive_failures = 0
 
1330
  ngram_step_addon = min(56, max(0, ngram_row_count) * NGRAM_ATTEMPTS_PER_TERM)
1331
  total_loop_steps = min(80, max_iterations + ngram_step_addon)
1332
 
 
 
 
 
 
 
 
 
 
1333
  current_text = target_text
1334
  current_analysis = baseline_analysis
1335
  current_semantic = baseline_semantic
 
1362
  "stop_reason": stop_reason,
1363
  }
1364
 
1365
+ _emit("preparing", message="Подготовка", phase="baseline")
1366
+ _emit(
1367
+ "started",
1368
+ total_steps=total_loop_steps,
1369
+ max_iterations_setting=max_iterations,
1370
+ ngram_targets=ngram_row_count,
1371
+ stages_order=list(STAGE_ORDER),
1372
+ )
1373
+
1374
  seen_candidate_rewrites = set()
1375
  cascade_level = 1
1376
  consecutive_failures = 0