Worker: write only what changed, sample downloads less
- The models folder scan compared nothing and rewrote local_folders on every run (delete all, insert all, each folder's file list included), every 2 minutes by default: ~1 MB of SQLite writes per scan with three large import folders. It now inserts new folders, updates changed ones and deletes gone ones; unchanged rows (compared by counts, commit and the stored JSON text) aren't written. - Download progress and the speed limit share one ProgressSampler. A file found complete isn't stat'ed or its hf metadata re-read again during the run, and with every file complete the partial files aren't listed. Before, every sample looked at every file, 5 times a second with a speed limit set. The check after hf exits still looks at every file. - A benchmark's phase is written when its step changes, not for every progress line BetterBench prints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
This commit is contained in:
8 files changed
+260
-8
No files matched your search
@@ -316,7 +316,7 @@ export type PcieLink = { gen: number | null; width: number | null };
|
||||
|
||||
/**
|
||||
* Folders in MODELS_DIR (`<org>/<name>`, like `hf download --local-dir` layouts) that no model uses,
|
||||
* found by the worker's scan. Rewritten on every scan; the web app offers them for import.
|
||||
* found by the worker's scan, which writes only what changed; the web app offers them for import.
|
||||
*/
|
||||
export const localFolders = sqliteTable("local_folders", {
|
||||
/** Relative to MODELS_DIR, e.g. "unsloth/Qwen3-8B-GGUF". */
|
||||
@@ -327,6 +327,7 @@ export const localFolders = sqliteTable("local_folders", {
|
||||
totalBytes: integer("total_bytes").notNull(),
|
||||
/** Commit from hf's download metadata, if the folder was written by `hf download`. */
|
||||
commit: text("commit"),
|
||||
/** When a scan last wrote this folder (found it, or found it changed). */
|
||||
scannedAt: ts("scanned_at").notNull(),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user