Run the same checks on Linux that the Windows scripts run
The product could only reach a GPU through one hard-coded route: `wsl.exe -d Ubuntu`, a device named "RTX 4090", and launch scripts that existed only as PowerShell. On this machine `WSL_DISTRO_NAME` is already set, so the local shell is Linux and the wsl.exe hop was unnecessary; on any other Linux host it is impossible. Every SGLang, vLLM and KTransformers profile was reported "missing" here even with a working 4090. profiles.py now asks the host what it is instead of assuming: `uses_wsl()` is false inside WSL and only true when wsl.exe is actually on PATH, `host_shell()` runs `bash -lc` directly or through `wsl.exe -d settings.wsl_distro`, `gpu_available()` replaced `wsl_gpu_available()`, and `launch_script()` picks the .sh twin on a Linux host and the .ps1 on a Windows one. The schema field `wsl_gpu` became `gpu_available` because the old name lied on Linux. Training no longer fails on a card name. `cuda_bf16_training()` gates on cuda_available plus bf16_supported, which the training environment already records, so an RTX 5090 or a 4080 passes and a non-BF16 4090 still fails. Fourteen .sh twins cover the six launch profiles plus install, verify, serve, download and finetune; the six WSL-hopping .ps1 files read ELY_EYE_WSL_DISTRO instead of Ubuntu. PowerShell parsing is not verified here because no pwsh exists on this host. ci.yml runs pytest, ruff, go build/vet/test/gofmt, the Vite build and a docker build-plus-curl on every push. To make that lint gate mean anything, the 17 pre-existing ruff findings across backend/src are cleared: 14 mechanical fixes plus three probe handlers that now name the failure families they absorb (OSError, SubprocessError, ValueError) instead of catching Exception. Verification: pytest 239 passed; ruff check backend/src bench clean (17 at HEAD); mypy on the 12 touched files 14 errors, identical at HEAD; pyright on the same files 8 errors, identical at HEAD; bash -n clean on all 15 .sh.
This commit is contained in:
1 parent
36f40c4c59
commit
922d01202f
34 files changed
+482
-88
No files matched your search
@@ -9,7 +9,7 @@ import shutil
|
||||
import subprocess
|
||||
import time
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
from importlib.metadata import PackageNotFoundError, version
|
||||
from pathlib import Path
|
||||
from typing import Any, TextIO
|
||||
@@ -20,7 +20,6 @@ from .config import Settings, get_settings
|
||||
from .db import Database
|
||||
from .schemas import AdapterManifest, EvidenceAtom, TrainingAdapterKind
|
||||
|
||||
|
||||
SYSTEM_PROMPT = (
|
||||
"You are Ely-Eye. Answer from supplied evidence, return compact JSON, "
|
||||
"and cite atom ids exactly."
|
||||
@@ -433,7 +432,7 @@ class TrainingService:
|
||||
gradient_accumulation_steps or self.settings.train_gradient_accumulation_steps
|
||||
)
|
||||
learning_rate = learning_rate or self.settings.train_learning_rate
|
||||
started_at = datetime.now(timezone.utc)
|
||||
started_at = datetime.now(UTC)
|
||||
wall_start = time.perf_counter()
|
||||
trace_path = output_dir / "training_trace.jsonl"
|
||||
|
||||
@@ -575,7 +574,7 @@ class TrainingService:
|
||||
processor.save_pretrained(output_dir)
|
||||
self.write_lora_config(output_dir, kind, rank, alpha, model_id)
|
||||
weight_stats = safetensor_weight_stats(output_dir / "adapter_model.safetensors")
|
||||
finished_at = datetime.now(timezone.utc)
|
||||
finished_at = datetime.now(UTC)
|
||||
wall_seconds = time.perf_counter() - wall_start
|
||||
summary_path = output_dir / "training_summary.json"
|
||||
proof_path = output_dir / "training_proof.json"
|
||||
@@ -671,7 +670,7 @@ class TrainingService:
|
||||
manifest = AdapterManifest(
|
||||
adapter_id=adapter_id(kind, dataset_path, model_id),
|
||||
kind=kind,
|
||||
created_at=datetime.now(timezone.utc),
|
||||
created_at=datetime.now(UTC),
|
||||
proof_version=TRAINING_PROOF_VERSION,
|
||||
training_method=TRAINING_METHOD,
|
||||
precision=TRAINING_PRECISION,
|
||||
@@ -756,7 +755,7 @@ class TrainingService:
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
max_length = max_length or self.settings.train_max_length
|
||||
learning_rate = learning_rate or self.settings.train_learning_rate
|
||||
started_at = datetime.now(timezone.utc)
|
||||
started_at = datetime.now(UTC)
|
||||
wall_start = time.perf_counter()
|
||||
trace_path = output_dir / "training_trace.jsonl"
|
||||
|
||||
@@ -882,7 +881,7 @@ class TrainingService:
|
||||
processor.save_pretrained(output_dir)
|
||||
self.write_lora_config(output_dir, TrainingAdapterKind.hme_retrieval, rank, alpha, model_id)
|
||||
weight_stats = safetensor_weight_stats(output_dir / "adapter_model.safetensors")
|
||||
finished_at = datetime.now(timezone.utc)
|
||||
finished_at = datetime.now(UTC)
|
||||
wall_seconds = time.perf_counter() - wall_start
|
||||
summary_path = output_dir / "training_summary.json"
|
||||
proof_path = output_dir / "training_proof.json"
|
||||
@@ -977,7 +976,7 @@ class TrainingService:
|
||||
manifest = AdapterManifest(
|
||||
adapter_id=adapter_id(TrainingAdapterKind.hme_retrieval, dataset_path, model_id),
|
||||
kind=TrainingAdapterKind.hme_retrieval,
|
||||
created_at=datetime.now(timezone.utc),
|
||||
created_at=datetime.now(UTC),
|
||||
proof_version=TRAINING_PROOF_VERSION,
|
||||
training_method=TRAINING_METHOD,
|
||||
precision=TRAINING_PRECISION,
|
||||
@@ -1269,7 +1268,7 @@ def trainable_update_l2(before_update: dict[str, Any], named_parameters: list[tu
|
||||
|
||||
def require_cuda_bf16(torch_module: Any) -> None:
|
||||
if not torch_module.cuda.is_available():
|
||||
raise RuntimeError("PRD 12.2 training requires CUDA BF16 on the local RTX 4090.")
|
||||
raise RuntimeError("training needs a CUDA device; none is available.")
|
||||
bf16_supported = getattr(torch_module.cuda, "is_bf16_supported", lambda: False)
|
||||
if not bool(bf16_supported()):
|
||||
raise RuntimeError("PRD 12.2 training requires BF16-capable CUDA hardware.")
|
||||
@@ -1598,7 +1597,7 @@ def slugify(value: str) -> str:
|
||||
|
||||
|
||||
def adapter_id(kind: TrainingAdapterKind, dataset_path: Path, model_id: str) -> str:
|
||||
raw = f"{kind.value}:{model_id}:{dataset_path.resolve()}:{datetime.now(timezone.utc).isoformat()}"
|
||||
raw = f"{kind.value}:{model_id}:{dataset_path.resolve()}:{datetime.now(UTC).isoformat()}"
|
||||
return f"{kind.value}_{sha256_bytes(raw.encode('utf-8'))[:12]}"
|
||||
|
||||
|
||||
@@ -1632,7 +1631,7 @@ def sha256_bytes(data: bytes) -> str:
|
||||
|
||||
|
||||
class _DigestWriter:
|
||||
def __init__(self, digest: "hashlib._Hash") -> None:
|
||||
def __init__(self, digest: hashlib._Hash) -> None:
|
||||
self.digest = digest
|
||||
|
||||
def write(self, data: bytes) -> int:
|
||||
|
||||
Reference in new issue
Block a user