Commit History
-
Sync develop into main (#52)
Unverified signature* Set up develop/main two-stage deploy: retarget dev-en to develop, add prod-en workflow develop -> dev-en Space (staging), main -> prod-en Space (release). See #26 for the release flow design. * Centralize print_*() logging functions in logging_utils.py (#29) Consolidates the named print_*() functions that #23 extracted in model_loading.py, inference.py, examples_ui.py, image_codec.py, and the qwenimage attention/pipeline modules into logging_utils.py, alongside the print_log_*() functions already there, so all logging lives in one file instead of being scattered per-module. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> * Rename dev-en's repo variable from HF_SPACE_ID to HF_SPACE_ID_DEV_EN (#30) Matches the <ENV>_<LANG> naming already used by HF_SPACE_ID_PROD_EN and HF_SPACE_ID_PROD_JA — the bare HF_SPACE_ID for dev-en was the odd one out. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> * Extract _InferTimer into a generic Timer in timing.py (#32) print_timi…8c202fb
-
Introduce a two-stage develop/main deploy flow (#27)
Unverified signature* Set up develop/main two-stage deploy: retarget dev-en to develop, add prod-en workflow develop -> dev-en Space (staging), main -> prod-en Space (release). See #26 for the release flow design. * Centralize print_*() logging functions in logging_utils.py (#29) Consolidates the named print_*() functions that #23 extracted in model_loading.py, inference.py, examples_ui.py, image_codec.py, and the qwenimage attention/pipeline modules into logging_utils.py, alongside the print_log_*() functions already there, so all logging lives in one file instead of being scattered per-module. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> * Rename dev-en's repo variable from HF_SPACE_ID to HF_SPACE_ID_DEV_EN (#30) Matches the <ENV>_<LANG> naming already used by HF_SPACE_ID_PROD_EN and HF_SPACE_ID_PROD_JA — the bare HF_SPACE_ID for dev-en was the odd one out. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> * Extract _InferTimer into a generic Timer in timing.py (#32) print_timi…6e3ec3e
-
Extract print() calls into named print_*() functions (#23)
Unverified signatureGroups the scattered logging statements across model_loading.py, inference.py, logging_utils.py, image_codec.py, examples_ui.py, and the qwenimage attention/pipeline modules into one dedicated function per message, making each log line easy to find, name, and reuse. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>98269eb -
Clean up experimental logging from the module-level .to('cuda') investigation (#25)
Unverified signatureRemoves zerogpu_timing_patch.py (pack_tensors/pack_to_cuda timing monkeypatch) and the wall-clock dispatch/entry timestamps added to measure ZeroGPU's pack/unpack cost — that question is answered (see PR #21/#24 discussion) and didn't need to keep shipping in production logs. Also drops _log_pipe_placement, whose only purpose was confirming the module-level load landed as expected during that investigation. Rewords the now-stale "EXPERIMENTAL" comments left over from before this became the shipped design. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>9598a80 -
Fix OOM: stop double-allocating text_encoder (bf16 + int8) on GPU (#24)
Unverified signatureThe module-level .to('cuda') pattern from #21 moved the whole pipeline (including the bf16 text_encoder) to CUDA at startup via ZeroGPU's emulation. But inference.py's _ensure_int8_text_encoder replaces pipe.text_encoder with an int8 copy on nearly every request — and the old bf16 copy's ~15.4GB was never actually freed, because ZeroGPU's own `tensor_packs` bookkeeping (spaces/zero/torch/patching.py) holds a permanent reference to every module-level-loaded tensor for the life of the (forked) worker, independent of what our own code does with `pipe.text_encoder` afterwards. Confirmed via a live OOM on FireRed-Dev: alloc=43.46GB (~19GB transformer + ~15.4GB stranded bf16 text_encoder + ~8.75GB int8 text_encoder) against a 47.4GB MIG slice, crashing during VAE decode. Fix: don't move text_encoder to CUDA at module level at all — leave it CPU-resident (model_loading.py), so _ensure_int8_text_encoder's swap never has a GPU-resident bf16 copy to strand in the first place. Added _ensure_bf16…5f1d4d1 -
Experiment: load transformer/pipeline via module-level .to('cuda') (#21)
Unverified signatureRe-validates HF's documented ZeroGPU pattern (models placed on 'cuda' at root module level, relying on ZeroGPU's CUDA-emulation + torch.move() transfer) against the current spaces==0.51.1, per the disk-pack/unpack regression investigated in 6c0477d and left open in issue #1. - model_loading.py: transformer/pipeline now load straight onto `device` instead of CPU-then-manual-.to(device); spaces imported first per HF's "import spaces before any CUDA-touching code" requirement. - zerogpu_timing_patch.py: wraps spaces.zero.torch.patching.pack_tensors/ pack_to_cuda to print how long the CPU->disk pack (startup-only) and disk->CUDA unpack (per fresh worker) actually take. - inference.py: replaces the manual _place_pipe_on_device/_FAST_PATH_MIN_GB OOM-fallback dance with a placement-confirmation log line, since ZeroGPU's own worker_init now does that transfer before this function body runs. Adds wall-clock dispatch/entry timestamps to bound the gap from the caller's side too. …cf338bd -
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 -
Split app.py into cohesive modules (#17)
Unverified signatureapp.py mixed five unrelated concerns in one 733-line file: env/model startup, base64<->PIL image codec, example/suggestion HTML building, per-request inference orchestration, and Gradio UI wiring. Split each into its own module (image_codec.py, examples_ui.py, model_loading.py, inference.py) so app.py is left as thin UI assembly + entrypoint. No behavior changes: every function/class from the original app.py is preserved verbatim in its new home (verified via a def/class-name diff), and the existing test suite still passes unchanged. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>63be854