Commit History
-
Enforce strict typing on Python code with mypy (#20)
Unverified signature* Enforce strict typing on Python code with mypy Adds mypy --strict configuration scoped to the project's own code (app.py, inference.py, model_loading.py, logging_utils.py, dimensions.py, mode.py, image_codec.py, examples_ui.py, tests/), excluding qwenimage/ since it's vendored from HuggingFace diffusers rather than code we own. Fully annotates the in-scope modules and tests, and enforces the check going forward via a GitHub Actions workflow and a local pre-commit hook. Fixes #19 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Move mypy's scoped file list into pyproject.toml CI and pre-commit invoked mypy with the same long, repeated list of files on the command line. mypy already supports a `files` setting in [tool.mypy], so both call sites now just run `uv run mypy` with no args. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>698eb37
-
Skip text_encoder CPU offload in fast mode; type mode as an enum
Logged phase timing showed the text_encoder-to-CPU offload before VAE decode costs ~9.7s, while decode itself takes ~113ms. That offload was freeing memory decode never needed at fast mode's small resolution (measured peak stayed well under the MIG slice's headroom) — it exists to prevent OOM at high-detail's much larger 2048px decode, so it's kept there and only skipped for fast mode. Replaced the raw "fast"/"high_detail" string comparisons scattered across dimensions.py and app.py with a Mode enum (mode.py) that owns both behaviors (max_dim, offloads_text_encoder_before_decode) as properties on the variant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>39867e3 -
Speed up fast mode: lower resolution cap, skip needless VAE tiling, fewer steps
Fast mode's 768px (was 1024px) output now stays under the VAE's tiling threshold, so it decodes in a single pass instead of a tiled decode with blend overhead that was only ever needed for high-detail's 2048px case. Also gives fast mode a lower default step count (3 vs 4), following the existing mode-scoped-default pattern already used for GPU duration. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>9fcf338
-
Batch log uploads to avoid HF 256-commits/hour rate limit
Replaces per-inference commit (prune + upload = 2 commits) with a LogUploader class that queues parquet files locally and flushes them in a single batched commit every LOG_BATCH_INTERVAL seconds (default 60). At full load this reduces commit rate from O(requests) to ~1/minute. Also splits _build_commit_ops into _build_add_ops and _build_delete_ops so each helper has a single responsibility, and updates tests accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2f63460 -
Switch log pruning from time-based to count-based
Replaces LOG_MAX_DAYS (delete files older than N days) with LOG_MAX_FILES (keep only the N most recent files, default 5000), preventing the HuggingFace 10k-files-per-directory hard limit from being hit. Deletions are batched into a single create_commit call using CommitOperationDelete instead of one delete_file call per file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c149547
-
Squash git history daily to free LFS storage from pruned files
api.delete_file only removes file pointers from the current tree; the LFS objects remain referenced in prior commits. _maybe_squash_history calls super_squash_history once per day (throttled via a marker file at metadata/last_squash.txt) to collapse history into one commit, making deleted LFS objects eligible for GC within 36 hours. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0597d39 -
Extract _make_path as single source of truth for parquet file naming
Previously the naming format was duplicated between log_inference and the contract test. _make_path centralises it so any change to the format is caught immediately by test_file_date_matches_make_path. The _file helper in tests also uses _make_path to stay consistent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>9235827 -
Pass now to _prune_old_files for deterministic boundary testing
Mirrors the same pattern used by _build_table. Tests now use a fixed NOW constant and relative offsets, enabling precise boundary checks (exactly keep_days old is kept, keep_days+1 is deleted). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>818b129 -
Auto-prune log files older than LOG_MAX_DAYS (default 7) after each upload
Without pruning, parquet files accumulate indefinitely and risk exceeding the HF private storage free tier. After each successful upload, old files are deleted from the dataset repo using a date-prefix comparison on the filename. Refactors log_inference into single-responsibility helpers (_img_to_jpeg, _build_table, _upload_parquet, _prune_old_files) to make the prune logic unit-testable without real network calls or waiting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ca0e7d6
-
Extract dimension calc, add pytest, fix aspect ratio rounding
- Extract compute_output_dimensions() into dimensions.py with comment explaining why round-to-8 is used instead of floor - Add tests/test_dimensions.py (23 cases) covering multiples-of-8, long-side pinning, aspect ratio error bound, and round-beats-floor - Add pytest to requirements.txt - app.py delegates to compute_output_dimensions() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2837b03