Spaces:
Running on Zero
Running on Zero
Commit History
3 days ago
-
fix: the image preloads the prompt enhancer too: a third preload_from_hub entry, generated like the others, fetches the 8 files its loader reads at its pinned commit (2.49 GB), so a first enhanced call in a fresh container no longer risks paying the ~88 s Hub fetch inside its GPU reservation; the start-up prefetch stays as the fallback (#23)
Unverified signatureThe reservation for Enhance is now sized for a warm enhancer (+80 s, #21). A first enhanced call in a container whose daemon prefetch (app.py, enhance.start_prefetch) had not finished would have spent the ~88 s download inside that reservation and could have been aborted. The enhancer repo, google/gemma-4-E2B-it-qat-mobile-transformers at dd693ff4, is not gated, so the Space's preload can fetch it at the same time as the model. One source. The repo id, the pin and the files with their sizes live in model_files (ENHANCER_REPO_ID, ENHANCER_REVISION, ENHANCER_SIZED_FILES / ENHANCER_FILES), and preload_from_hub_entries() emits a third entry from them, which the drift test keeps the README equal to. config.DEFAULT_PROMPT_ENHANCER_REPO and enhance.ENHANCER_REVISION now read those values instead of holding their own literals. The list lives in model_files rather than beside the loader in enhance.py because the architecture test (test_no_hardcoded_hub_strings_outside_model_files) admits a che…72b989d -
fix: start-up refuses a fallback download the disk cannot hold, before writing a byte: the missing files, ZeroGPU's packed copy still to be written and a 10 GB margin must fit in the free space (on ZeroGPU, also under its 150 GB cap), or start-up stops with one message naming the directory, the count and GB, the free GB and the remedy (#23)
Unverified signatureA download that fills the disk part-way is the worst failure a public Space can have; a clear refusal is better. ensure_weights now calls _require_room(missing bytes, count, cache directory, on_zerogpu) after it has found what is missing and before it says it is downloading. Needed: the missing bytes (from model_files' per-file sizes), a 10 GB margin and, on ZeroGPU only, the packed copy still to be written: ZEROGPU_PACKED_COPY_GB = 42.1 (40.6 GB measured on the 2026-11-13 boot, 41.24 derived, plus the 0.83 GB decoder now packed with it). A CUDA box that is not ZeroGPU packs nothing to disk, so it is not charged for one; it fetches the set with 81.9 GB free. Free: shutil.disk_usage of the cache directory (or its nearest existing parent). On ZeroGPU that is the host's filesystem -- the first deploy's report once read 1969.8 GB free of 8589.9 GB there while the workload was being evicted (pipelines.disk_footprint's docstring) -- so on its own it could never refuse. On ZeroGPU the room …ff62c55 -
fix: the diffusion decoder is built once at start-up, beside the pipeline, so ZeroGPU packs it and every run's worker uses that instance instead of loading it again; a start-up build that fails logs one line and leaves the per-run build as before (#17)
Unverified signatureOn the Space the default decode is the diffusion decoder. It was built lazily inside each GPU worker and lost with it: every run loaded its 0.83 GB and resolved its NATTEN kernel over the network again (its load message appeared in every run's log of deploy 1). pipelines.build_decoder_at_startup(device=...) builds it with the existing _decoder_part, after the runners, and caches it where the runners' decoder factory already looks. app.py calls it at module scope in the CUDA branch, after the two get_pipeline calls, so its .to("cuda") is intercepted and registered for packing with the other components before demo.launch(); a forked worker's runner then finds the instance through _decoder_part's cache. get_pipeline itself still builds no decoder. Whether the NATTEN fetch needs a GPU at load time: it does not. diffusers' processor calls kernels.get_kernel("shi-labs/natten", version=1): the version-to-ref lookup and the variant download are network and disk; the build variant is chosen f…ed13532 -
fix: the Space's weights come from the image: preload_from_hub is live for exactly the 35 files the int8 Space loads (71.92 GB; the temporal upsampler, which nothing loads, is no longer fetched), every file carries its size in model_files, and start-up downloads only what the image lacks, saying how much (#23)
Unverified signatureThe Space is public now, so the gated repo can be preloaded; while it was private the preload step ran without the Space's secrets and got 401, and every cold start downloaded 72.19 GB itself (17 min 24 s on 2026-11-16, 14 min 55 s of it the download). model_files is the single source of the set and its sizes: each component lists its files with their byte sizes from the Hub's own listing at the pinned commits, size_gb is derived from them, and file_size / total_size_bytes answer per file and per set. temporal_latent_upsampler moves to the declared-but-not-fetched group: StageRunner wires only the spatial latent_upsampler and model_index.json does not list it, so it cost 0.26 GB on every start for nothing. The set goes from 37 files / 72,185,863,109 B to 35 files / 71,923,919,050 B. README front matter: preload_from_hub is live, generated by model_files.preload_from_hub_entries() (two entries, one per pinned commit: the decoder is pinned later), and its comment says what it does, why…41dcf05 -
fix: bitsandbytes' int8 cast warning reaches the log once per process instead of once per matrix product, so the Space's log keeps its start-up report and its real warnings (#15)
Unverified signaturebitsandbytes 0.50.2 logs "MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization" (logger.warning on bitsandbytes.autograd._functions) on every int8 matrix product. On deploy 1 that was 55,400 of the last 55,534 lines of the Space's log after eleven runs, and the platform keeps only the tail, so the start-up report and every real warning were pushed out. A logging.Filter on that logger (ltx25_studio/log_filter.py) lets the message through once per process and drops its repeats. It is keyed by the process id and the rendered message, so a forked worker records the fact once for itself and a different dtype is a different line. Every other record on that logger passes, the logger's level stays NOTSET so bitsandbytes' other warnings still reach the log, and no other logger is touched. The filter is attached by the logger's name, so bitsandbytes is not imported: its own getLogger(__name__) returns the same object, filter included, whenever it loads. install()…18bcc7a
4 days ago
-
fix: an output folder outside the working directory and the temp dir is passed to launch as allowed_paths, so Gradio serves the results written there
Unverified signatureGradio serves a file a step returns only from the working directory, the system temp dir, its own cache or launch(allowed_paths=...). With LTX25_OUTPUT_DIR outside the first two, the run on real weights finished and Gradio refused its file. app.main() now asks ui.blocks.served_outputs() about the configured output folder (generate.configured_output_root(), the folder the writer and the startup sweep use). Resolved, links included as Gradio resolves them, a folder under the working directory or the temp dir needs nothing and the launch is exactly as before (the default outputs/, and the Space). A folder outside both is passed as the only allowed path, with one log line saying so. tests/test_app_launch.py imports the app and calls main() with launch replaced, against a working directory and a temp dir of the test's own: the default folder, one under the temp dir and one reached through a link into it launch with max_file_size alone; an absolute or relative folder outside both is passed…e7cde1a -
feat: one device resolver — CUDA on ZeroGPU, MPS/CPU by opt-in, and no silent 70 GB load anywhere else
Unverified signature`LTX25_DEVICE` = auto | cuda | mps | cpu, resolved once by `device.resolve()` and used by app.py, `pipelines.get_pipeline` and the stage-2 runner. `auto` is CUDA on ZeroGPU (answered from `spaces` alone, no CUDA probe in the web process) or on a CUDA host, and otherwise no generation device: the UI starts and Generate raises `GenerationDisabledError`, saying in plain words how to opt in, before any model or the enhancer is loaded. A Mac with the weights on disk used to build the whole pipeline on the CPU on the first click. The Space path is unchanged: the same module-scope build with `.to("cuda")`, the same int8 mapping and skip list, and the same static decorator. Defaults that work with no Space variable (F10): size xlarge (`auto` sent no size and got the 47.4 GiB `large` slice; ZeroGPU does not promote by itself), 180 s, quantisation `auto` = int8 on ZeroGPU and bf16 elsewhere. int8 on MPS/CPU is a startup ConfigError that says bitsandbytes has no kernels there. `zerogpu.partition…0ed2aa1
-
fix: the enhancer's nine-minute wall — the rewrite moves onto the GPU it was priced for
Unverified signaturePrompt enhancement shipped in the web process, on the CPU, to stay out of ZeroGPU's packing window. The disk half of that argument was researched, checked against the packer's source, and is correct. The latency half was never measured. On the live Space, text_to_video at 256x256x9: enhance OFF 15.38 s enhance ON, cold 654.15 s (+638.8) enhance ON, warm 553.45 s (+538.1) The cold/warm split isolates it: the 2.46 GB fetch is 88 s and the weights load in under a second, so the download is not the cost. ~538 s is the CPU decode of 600 greedy tokens, about 0.9 s/token. The "1-2 s" that justified the CPU placement was a GPU number applied to a CPU placement — 600 tokens in 2 s is 300 tok/s, which no CPU does on a 5B-parameter model. "Where does it run" has two axes, disk and latency. One was optimised and the other was never measured. That is the transferable part and it is written into PLAN §3.5, UI_DESIGN and enhance.py rather than into this message alone…f967e30
-
fix: bound uploads at launch — max_file_size from the LoRA ceiling, the one lever both sides read
Unverified signaturedemo.launch() accepted uploads of any size. They land on gradio's tmp disk BEFORE any check of ours can run — stage 1 of the LoRA validator refuses oversized adapters by declared size without reading them, but it never sees the request until gradio has already spooled it — and the retention sweep covers outputs/ only, so nothing ever reclaims the space. One request could fill the Space's disk. The bound is CONFIG.lora_max_bytes * 1.05: the largest upload the app has any use for is a LoRA at the validator's own ceiling (12 GB default; conditioning media is orders of magnitude smaller), read off the CONFIG so the LTX25_LORA_MAX_GB lever bounds both the validator and the transport rather than drifting apart. The 5% margin covers multipart framing, so a ceiling-sized adapter is refused by stage 1's message — which names the limit and the actual size — instead of gradio's blunter transport error. Scope note: max_file_size is launch()'s only change; the GPU decoration is untouched. The tes…db233ed
-
fix: gate GPU work on capability, not on being a Space
Unverified signatureapp.py gated the weight download, the preflight and the CUDA move on ON_ZEROGPU. On a real 97 GB GPU box that is false, because the box simply is not a Space — so it downloaded nothing, built nothing, moved nothing to CUDA, and ran a non-strict preflight that therefore did not complain either. The UI came up and the first generation went nowhere. The guard asked which host this is when it needed to ask whether this host can do GPU work. will_use_gpu answers the second question, and the same three lines now do the right thing in both places: on ZeroGPU .to('cuda') is intercepted and packs to disk, on a plain CUDA box it is a real VRAM move. That difference belongs to the platform. The short-circuit ordering is load-bearing rather than stylistic — spaces is checked before CUDA is probed, because touching torch.cuda at module scope on a Space is the failure the whole import-order rule exists to prevent. The test asserts the probe was NEVER CALLED, not what it returned; reversing the two…bd190ee -
fix: download weights at runtime; a private Space cannot preload
Unverified signatureThe build succeeded and the preload init step failed with 401 on a gated file. 401 is unauthenticated, not unauthorised: the preload runs as a separate platform-managed step that does not receive Space secrets, so the request arrives with no credentials however valid the token is. Verified both ways — the public 2.3 Space preloads a gated=manual repo fine, this private one 401s on gated=auto, and the same URL fetches 200 by hand. preflight.ensure_weights() fetches the 37 files inside the app, where the token exists, from the same download_allow_list() so the single-source property is unchanged. It logs every file, because a 72 GB cold start that goes quiet for forty minutes is indistinguishable from one that has stopped, and it fails naming the file, its position, the underlying error class and its URL. This is the better design even if that diagnosis is wrong, which is why it beat making the Space public: it removes the ownership bug class outright. Preloaded files belong to the bui…f355817 -
fix: thread one frame rate to both the pipeline and the container
Unverified signatureGenerationRequest gains frame_rate, defaulting to constraints' DEFAULT_FRAME_RATE, and it is passed to the encoder AND — the step that matters — to the pipeline via the mode builders. Step 2 only looks redundant because both values are 24.0 today. Without it the rate the model generates at and the rate the container declares are two independent numbers that happen to agree, and the first change to either plays the video at the wrong speed with no error at all. Same silent-desync class as the audio/video length problem, so it gets the same treatment: one value, threaded. pipelines gains a tripwire asserting upstream's own frame_rate default still matches ours, the same shape as the compression-ratio check. Also fixes a real bug in the ZeroGPU dispatch I added: run_generation resolved generate by module attribute, so any wrapper installed after startup sent the worker straight back through itself — the new seam tests caught it as 'multiple values for keyword argument'. The entrypoint …3f5d8f4 -
fix: actually wire ZeroGPU into the running app
Unverified signatureThree blockers, all the same failure: rules this project wrote down, argued for at length, and never executed. Every @spaces.GPU and .to('cuda') in the tree was prose inside a docstring. zerogpu.py was not imported by the app at all, so assert_returnable, gpu_decorator_kwargs and check_duration_signature were unreachable. Nothing was ever moved to CUDA, so the packer never ran. The build would have deployed, started, and never touched a GPU. app.py now carries a literal, unconditional @spaces.GPU(**kwargs) on the one function that runs a generation. Unconditional matters: a decorator behind an if is how a documented rule quietly stops being applied, because the Space path stops being the path anyone runs. Off-Space, spaces is a stub whose GPU returns the function unchanged, so the wiring is identical everywhere and only its effect differs. generate() routes through that entrypoint when one is registered, guarded by a contextvar against recursing into itself, so a run started from the…efdddfc -
fix: wire output retention; expose latent_to_pixel_index
Unverified signatureenforce_retention was correct, specced and never called — so the disk fill it exists to prevent was not actually prevented. Now swept at app startup and after every successful generation, logging each eviction and surfacing it on the result's warnings. Deliberately non-fatal in both places. The user's video exists and is fine, so a retention failure must not turn a good run into an error, and a bad cap must not stop the app from starting. Surfaced as a warning rather than swallowed. latent_to_pixel_index and pixel_to_latent_index are thin aliases over the existing conversions, so the UI can show a live pixel-frame readout without copying max((latent - 1) * ratio + 1, 0) into the render layer. A second copy could drift, and a readout that disagrees with the generator is worse than no readout.4b80aee -
feat: implement pipelines and wire app.py — suite green
Unverified signaturepipelines.py carries the stage graph with the explicit diffusion decode. The classic pipelines decode with the convolutional VAE, but the diffusion decoder is 2.5's native default, so a naive call does not error — it is just permanently worse, silently. denormalize=False is mandatory because output_type='latent' already returns denormalized latents and the default double-denormalizes. assert_compression_ratios is the tripwire for the 8 and 32 that constraints.py must carry as pre-load defaults, since the UI validates geometry before any VAE exists. If upstream changes them, failing here beats generating at the wrong geometry. zerogpu.py no longer imports spaces. It is a deploy-environment package and importing it from library code makes the library unimportable off-Space — the architecture spec is right to forbid it. spaces_version now takes the module, and app.py owns the import, which is also the only place the before-torch ordering can be guaranteed. app.py imports spaces first, …55dc097 -
chore: scaffold package, tooling config, and module stubs
Unverified signatureCreates the ltx25_studio package with importable stubs for every module in the PLAN §7.1 layout, each carrying its responsibility and the plan sections that constrain it. No app logic. pyproject.toml carries project metadata plus ruff and pytest config, with pythonpath = ['.'] so tests import the package in place. No testpaths, because tests/ is owned by another teammate and does not exist yet — pointing testpaths at a missing directory turns the gate into a usage error instead of an honest 'no tests ran'. requirements.txt is deliberately absent pending the dependency pins and the diffusers-revision ruling (PLAN §10 OQ-1).ca5c091