fix: resolve model weight paths against DATA_DIR (REQ-187)
- config.py: resolve_data_path (legacy abs + rel) + rel_data_path - all file-opening reads wrapped: preview, autolabel, training, model download, live count, projects.get; training_start_point hack replaced - new writes store paths relative to data/ - legacy stale rows (/home/asus/reTraining/...) resolve without migration - requirements: REQ-187 added; REQ-188 (per-class max box) + REQ-186 copy-line amendment drafted for the next task
This commit is contained in:
1 parent
8f41c6c85a
commit
dee58e4ae5
10 files changed
+93
-32
No files matched your search
+5
-3
@@ -155,11 +155,11 @@ def promote(model_id: int) -> dict:
|
||||
project = projects.get(version["project_id"])
|
||||
base_path = os.path.join(config.project_dir(project["slug"]), "base", "model.pt")
|
||||
os.makedirs(os.path.dirname(base_path), exist_ok=True)
|
||||
shutil.copyfile(version["weights_path"], base_path)
|
||||
shutil.copyfile(config.resolve_data_path(version["weights_path"]), base_path)
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"UPDATE projects SET base_model_path = ?, base_model_kind = 'trained' WHERE id = ?",
|
||||
(base_path, project["id"]),
|
||||
(config.rel_data_path(base_path), project["id"]),
|
||||
)
|
||||
return projects.get(project["id"])
|
||||
|
||||
@@ -289,7 +289,9 @@ def _run_train(job) -> None:
|
||||
parent_model_path, metrics, base_metrics,
|
||||
created_at, augment, name)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||
(project["id"], version, weights, project["base_model_path"],
|
||||
(project["id"], version, config.rel_data_path(weights),
|
||||
config.rel_data_path(project["base_model_path"])
|
||||
if project["base_model_path"] else project["base_model_path"],
|
||||
json.dumps(comparison["new"]), json.dumps(comparison["base"]), time.time(),
|
||||
json.dumps(augmentation["settings"]),
|
||||
_generate_model_name(project, start_point, settings["epochs"], class_ids)),
|
||||
|
||||
Reference in new issue
Block a user