update from asus 106

This commit is contained in:
asus committed 2026-08-05 15:56:11 +07:00
1 parent 6637fb1302
commit 8285400254
28 files changed
+3215 -459

No files matched your search

+9 -4
View File
@@ -25,7 +25,7 @@ def models_dir(project_slug: str) -> str:
return os.path.join(config.project_dir(project_slug), "models")
def start(project_id: int, epochs: int = 50, overrides: Optional[dict] = None, batch_ids: Optional[list] = None) -> dict:
def start(project_id: int, epochs: int = 50, overrides: Optional[dict] = None, batch_ids: Optional[list] = None, class_ids: Optional[list] = None) -> dict:
project = projects.get(project_id)
if project is None:
raise TrainingError("No such project")
@@ -38,7 +38,7 @@ def start(project_id: int, epochs: int = 50, overrides: Optional[dict] = None, b
settings = hardware.resolve(overrides, epochs)
job = jobs.create(
"train",
params={"project_id": project_id, "settings": settings, "batch_ids": batch_ids},
params={"project_id": project_id, "settings": settings, "batch_ids": batch_ids, "class_ids": class_ids},
project_id=project_id,
message=f"{counts['train']} train / {counts['val']} val",
)
@@ -102,7 +102,8 @@ def _run_train(job) -> None:
project = projects.get(job.params["project_id"])
settings = job.params["settings"]
batch_ids = job.params.get("batch_ids")
data_yaml = dataset.write_data_yaml(project, batch_ids=batch_ids)
class_ids = job.params.get("class_ids")
data_yaml = dataset.write_data_yaml(project, batch_ids=batch_ids, selected_class_ids=class_ids)
# SAM3 and a training run must not hold VRAM at the same time (REQ-065).
from backend.sam3_engine import release_engine
@@ -133,6 +134,10 @@ def _run_train(job) -> None:
model.add_callback("on_fit_epoch_end", on_epoch)
job.progress(0, settings["epochs"])
import torch
if torch.cuda.is_available():
torch.backends.cudnn.benchmark = True
keep_run_dir = False
try:
model.train(
@@ -142,7 +147,7 @@ def _run_train(job) -> None:
batch=settings["batch"],
device=settings["device"],
workers=settings.get("workers", 8),
cache=False,
cache="ram",
project=os.path.join(out_dir, "runs"),
name="train",
exist_ok=True,