linoyts's picture
linoyts HF Staff
Upload README.md with huggingface_hub
953ae2e verified
|
Raw
History Blame Contribute Delete
2.94 kB
---
tags:
- ahead-of-time
- pytorch
- ltx-2.3
- zerogpu
library_name: diffusers
base_model: diffusers/LTX-2.3-Diffusers
---
# LTX-2.3 Transformer β€” AOTI build (in-context, **no self-attention mask**)
Ahead-of-time **precompiled** `transformer_blocks` of `LTX2VideoTransformer3DModel`
for **ZeroGPU (sm120 / cu130)**. The package is the compiled **graph only β€” no weights**,
so it works with:
- the **base** *and* **distilled** LTX-2.3 (identical architecture), and
- **any LoRA**, as long as it's **fused** into the transformer (`fuse_lora`, not `set_adapters`).
Dynamic over video- and audio-token counts β†’ one binary serves **any resolution / frame
count / duration**. Compiled for the `LTX2InContextPipeline` audio+video forward.
## When to use this repo
- **This build:** in-context IC-LoRA demos that **do not** pass a `conditioning_attention_mask` (and keep `conditioning_attention_strength=1.0`) β€” e.g. colorize, deblur, decompress, reference-sheet, upscale, restyle.
- **Inpaint / outpaint** (which pass a `conditioning_attention_mask`) β†’ use
[`ltx-community/LTX-2.3-Transformer-GroupB-sm120-cu130-r0e`](https://huggingface.co/ltx-community/LTX-2.3-Transformer-GroupB-sm120-cu130-r0e).
- STG (`stg_scale>0`, perturbs only block 28) is **not** supported by this uniform per-block build.
## Use it (ZeroGPU) β€” load at the **root module level**
```python
import spaces, torch
from diffusers import LTX2InContextPipeline
pipe = LTX2InContextPipeline.from_pretrained(
"diffusers/LTX-2.3-Distilled-Diffusers", torch_dtype=torch.bfloat16
).to("cuda")
# fuse your IC-LoRA (the AOTI graph is weight-agnostic, but the LoRA must be FUSED, not set_adapters)
pipe.load_lora_weights(my_lora_state_dict, adapter_name="x")
pipe.fuse_lora(lora_scale=1.0)
pipe.unload_lora_weights()
# load the precompiled blocks AT ROOT LEVEL (ZeroGPU loads on cuda at module scope; do NOT
# lazy-load or move to cuda inside @spaces.GPU β€” see the ZeroGPU model-loading docs)
spaces.aoti_load(module=pipe.transformer, repo_id="ltx-community/LTX-2.3-Transformer-GroupA-sm120-cu130-r9e")
@spaces.GPU
def generate(*args, **kwargs):
return pipe(*args, **kwargs) # nothing AOTI-related in here
```
Public repo (graph only) β†’ no token needed. Built with the job in this repo's `job.py`.
## How to reproduce or customize
This repo bundles the `job.py` that built it. To rebuild (or retarget to another GPU arch / base model), download it and run on HF Jobs:
```bash
hf jobs uv run job.py \
--flavor rtx-pro-6000 \
--image pytorch/pytorch:2.9.1-cuda13.0-cudnn9-devel \
--secrets HF_TOKEN
```
Customize the output repo name with `OUTPUT_REPO_BASE_NAME` / `OUTPUT_REPO_ID` (this is the default no-self-attention-mask build). The exact build environment (torch 2.12.0+cu130, etc.) is recorded in `environment.json`.
## Job run
- [linoyts/6a326f7f5ff0a6cf94fa00e8](https://huggingface.co/jobs/linoyts/6a326f7f5ff0a6cf94fa00e8)