File size: 2,940 Bytes
ab90d75
 
 
 
e2e0571
 
ab90d75
e2e0571
ab90d75
 
e2e0571
ab90d75
e2e0571
 
 
 
 
ab90d75
e2e0571
 
ab90d75
f49ade7
 
e2e0571
 
 
ab90d75
f49ade7
e2e0571
 
ab90d75
 
e2e0571
 
 
 
f49ade7
e2e0571
f49ade7
 
 
 
 
 
e2e0571
 
 
f49ade7
ab90d75
 
e2e0571
953ae2e
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
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)