Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(train): drop a function-local warnings import that shadowed the module

Nandakishor6ab95ea63467
diff --git a/laya/train.py b/laya/train.py
index 076b574b..cca4e6a0 100644
--- a/laya/train.py
+++ b/laya/train.py
@@ -816,8 +816,11 @@ def finetune(data: str, model_dir: str, output_dir: str, config: Optional[TrainC
if qid not in sample_questions:
sample_questions[qid] = qdef
elif sample_questions[qid] != qdef:
- import warnings
- warnings.warn("Conflicting schema detected for question %r across rows; keeping first seen definition." % (qid,))
+ # `warnings` is imported at module scope. A function-local `import warnings`
+ # here would make the name local for the whole of `finetune`, and the
+ # calibration warnings above it would then raise UnboundLocalError.
+ warnings.warn("Conflicting schema detected for question %r across rows; "
+ "keeping first seen definition." % (qid,))
if sample_questions:
for d in (output_dir, os.path.join(output_dir, "checkpoint_latest")):
os.makedirs(d, exist_ok=True)