Coerce num_epochs in normalized() and use utf-8 for run records
num_epochs was only int-coerced for the range check, so a string value from a dict-built config would reach resolve_train_steps' arithmetic; normalized() now stores the coerced int. Run record reads/writes pass encoding utf-8 explicitly so non-ASCII prompts survive on Windows
This commit is contained in:
parent
7a8f363c52
commit
2c5955bda8
2 changed files with 4 additions and 3 deletions
|
|
@ -407,6 +407,7 @@ class DiffusionLoraConfig:
|
|||
lora_target_modules = targets,
|
||||
max_grad_norm = float(self.max_grad_norm),
|
||||
hf_token = token or None,
|
||||
num_epochs = int(self.num_epochs),
|
||||
cache_variants = int(self.cache_variants),
|
||||
compile_transformer = compile_transformer,
|
||||
base_precision = base_precision,
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ def list_diffusion_runs(limit: int = 20) -> list[dict]:
|
|||
out: list[dict] = []
|
||||
for p in files[: max(0, int(limit))]:
|
||||
try:
|
||||
rec = json.loads(p.read_text())
|
||||
rec = json.loads(p.read_text(encoding = "utf-8"))
|
||||
except Exception: # noqa: BLE001 -- a corrupt record never breaks the listing
|
||||
continue
|
||||
# A valid-JSON file with the wrong shape (an old or hand-edited record that is not a
|
||||
|
|
@ -124,7 +124,7 @@ def get_diffusion_run(job_id: str) -> Optional[dict]:
|
|||
return None
|
||||
p = _runs_dir() / f"{job_id}.json"
|
||||
try:
|
||||
return json.loads(p.read_text())
|
||||
return json.loads(p.read_text(encoding = "utf-8"))
|
||||
except Exception: # noqa: BLE001 -- missing/corrupt record
|
||||
return None
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ class DiffusionTrainingService:
|
|||
},
|
||||
}
|
||||
path = _runs_dir() / f"{s['job_id']}.json"
|
||||
path.write_text(json.dumps(record))
|
||||
path.write_text(json.dumps(record), encoding = "utf-8")
|
||||
except Exception: # noqa: BLE001 -- persisting history must never break the run
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue