-- Training jobs (BACKLOG F4): a LoRA adapter trained on a node, from a base -- model's weights and question/answer pairs, and what it made. The pairs -- and the adapter are kept here, in the store every control plane reads: -- they are megabytes, and a job's record is worth little without them. CREATE TABLE train_jobs ( id TEXT PRIMARY KEY, -- name is the adapter's: what clients will ask for it by. name TEXT NOT NULL, -- model is the catalog model the adapter is for; base_repo and -- base_revision the weights it is trained on. model TEXT NOT NULL, base_repo TEXT NOT NULL, base_revision TEXT NOT NULL DEFAULT '', node TEXT NOT NULL, gpu_memory_mib INTEGER NOT NULL, params TEXT NOT NULL DEFAULT '', gguf INTEGER NOT NULL DEFAULT 0, data BLOB NOT NULL, pairs INTEGER NOT NULL, -- state is queued, starting, preparing, running, done, failed or -- cancelled. state TEXT NOT NULL, step INTEGER NOT NULL DEFAULT 0, steps INTEGER NOT NULL DEFAULT 0, loss REAL NOT NULL DEFAULT 0, message TEXT NOT NULL DEFAULT '', peak_mib INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, started_at INTEGER NOT NULL DEFAULT 0, finished_at INTEGER NOT NULL DEFAULT 0, created_by TEXT NOT NULL DEFAULT '' ); CREATE INDEX train_jobs_by_state ON train_jobs (state); -- What a job made: the PEFT adapter as a gzipped tar, and for llama.cpp the -- adapter as GGUF. CREATE TABLE train_artifacts ( job_id TEXT NOT NULL REFERENCES train_jobs(id) ON DELETE CASCADE, kind TEXT NOT NULL, data BLOB NOT NULL, PRIMARY KEY (job_id, kind) );