Instructions to use ltx-community/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ltx-community/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ltx-community/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,161 +1,53 @@
|
|
| 1 |
-
|
| 2 |
---
|
| 3 |
tags:
|
| 4 |
- ahead-of-time
|
| 5 |
- pytorch
|
|
|
|
|
|
|
| 6 |
library_name: diffusers
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
|
| 10 |
-
> This **README** has been auto-generated by the **HF Job** run linked below
|
| 11 |
-
> and the whole repository is a reproducible artifact of this Job
|
| 12 |
-
|
| 13 |
-
# Ahead-of-time repository
|
| 14 |
-
|
| 15 |
-
AoT repos contain **pre-compiled binaries** of PyTorch models, enabling:
|
| 16 |
-
- fast startup times (no `torch.compile` needed)
|
| 17 |
-
- significant **speedup**
|
| 18 |
-
- **ZeroGPU** compatibility
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
from PIL import Image
|
| 30 |
|
|
|
|
|
|
|
|
|
|
| 31 |
from diffusers import LTX2InContextPipeline
|
| 32 |
-
from diffusers.pipelines.ltx2.pipeline_ltx2_ic_lora import LTX2ReferenceCondition
|
| 33 |
-
from diffusers.pipelines.ltx2.utils import DISTILLED_SIGMA_VALUES
|
| 34 |
-
|
| 35 |
-
# base == distilled in architecture, so one compiled graph serves both; distilled is
|
| 36 |
-
# what most demos use. The AOTI package is weight-agnostic, so this base graph also
|
| 37 |
-
# serves any FUSED LoRA (fuse_lora before aoti_load on the Space).
|
| 38 |
-
MODEL_ID = os.environ.get("LTX_MODEL_ID", "diffusers/LTX-2.3-Distilled-Diffusers")
|
| 39 |
-
|
| 40 |
-
pipe = LTX2InContextPipeline.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16)
|
| 41 |
-
pipe.to("cuda")
|
| 42 |
-
pipe.vae.enable_tiling()
|
| 43 |
-
|
| 44 |
-
spaces.aoti_load(
|
| 45 |
-
module=pipe.transformer,
|
| 46 |
-
repo_id='linoyts/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3',
|
| 47 |
-
)
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
## How to reproduce or customize
|
| 51 |
-
``` bash
|
| 52 |
-
hf jobs uv run job.py --flavor rtx-pro-6000 --image pytorch/pytorch:2.9.1-cuda13.0-cudnn9-devel --secrets HF_TOKEN
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
## Samples
|
| 56 |
-
| Before compilation (0.42s) | After compilation (0.33s) |
|
| 57 |
-
|---|---|
|
| 58 |
-
| <video src="https://huggingface.co/linoyts/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3/resolve/main/samples/before/video.mp4" controls></video> | <video src="https://huggingface.co/linoyts/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3/resolve/main/samples/after/video.mp4" controls></video> |
|
| 59 |
-
|
| 60 |
-
Speedup: **1.27x**
|
| 61 |
-
|
| 62 |
-
## Environment
|
| 63 |
-
<details><summary>Click to expand</summary>
|
| 64 |
-
|
| 65 |
-
```
|
| 66 |
-
PyTorch version: 2.12.0+cu130
|
| 67 |
-
Is debug build: False
|
| 68 |
-
CUDA used to build PyTorch: 13.0
|
| 69 |
-
ROCM used to build PyTorch: N/A
|
| 70 |
-
|
| 71 |
-
OS: Ubuntu 22.04.5 LTS (x86_64)
|
| 72 |
-
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
|
| 73 |
-
Clang version: Could not collect
|
| 74 |
-
CMake version: version 4.1.2
|
| 75 |
-
Libc version: glibc-2.35
|
| 76 |
-
|
| 77 |
-
Python version: 3.10.19 (main, Oct 31 2025, 23:02:46) [Clang 21.1.4 ] (64-bit runtime)
|
| 78 |
-
Python platform: Linux-6.12.88-119.157.amzn2023.x86_64-x86_64-with-glibc2.35
|
| 79 |
-
Is CUDA available: True
|
| 80 |
-
CUDA runtime version: 13.0.48
|
| 81 |
-
CUDA_MODULE_LOADING set to:
|
| 82 |
-
GPU models and configuration: GPU 0: NVIDIA RTX PRO 6000 Blackwell Server Edition
|
| 83 |
-
Nvidia driver version: 580.159.03
|
| 84 |
-
cuDNN version: Could not collect
|
| 85 |
-
Is XPU available: False
|
| 86 |
-
HIP runtime version: N/A
|
| 87 |
-
MIOpen runtime version: N/A
|
| 88 |
-
Is XNNPACK available: True
|
| 89 |
-
Caching allocator config: N/A
|
| 90 |
-
|
| 91 |
-
CPU:
|
| 92 |
-
Architecture: x86_64
|
| 93 |
-
CPU op-mode(s): 32-bit, 64-bit
|
| 94 |
-
Address sizes: 46 bits physical, 48 bits virtual
|
| 95 |
-
Byte Order: Little Endian
|
| 96 |
-
CPU(s): 192
|
| 97 |
-
On-line CPU(s) list: 0-191
|
| 98 |
-
Vendor ID: GenuineIntel
|
| 99 |
-
Model name: Intel(R) Xeon(R) Platinum 8559C
|
| 100 |
-
CPU family: 6
|
| 101 |
-
Model: 207
|
| 102 |
-
Thread(s) per core: 2
|
| 103 |
-
Core(s) per socket: 48
|
| 104 |
-
Socket(s): 2
|
| 105 |
-
Stepping: 2
|
| 106 |
-
BogoMIPS: 4800.00
|
| 107 |
-
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd ida arat avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid cldemote movdiri movdir64b md_clear serialize amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
|
| 108 |
-
Hypervisor vendor: KVM
|
| 109 |
-
Virtualization type: full
|
| 110 |
-
L1d cache: 4.5 MiB (96 instances)
|
| 111 |
-
L1i cache: 3 MiB (96 instances)
|
| 112 |
-
L2 cache: 192 MiB (96 instances)
|
| 113 |
-
L3 cache: 640 MiB (2 instances)
|
| 114 |
-
NUMA node(s): 2
|
| 115 |
-
NUMA node0 CPU(s): 0-47,96-143
|
| 116 |
-
NUMA node1 CPU(s): 48-95,144-191
|
| 117 |
-
Vulnerability Gather data sampling: Not affected
|
| 118 |
-
Vulnerability Indirect target selection: Not affected
|
| 119 |
-
Vulnerability Itlb multihit: Not affected
|
| 120 |
-
Vulnerability L1tf: Not affected
|
| 121 |
-
Vulnerability Mds: Not affected
|
| 122 |
-
Vulnerability Meltdown: Not affected
|
| 123 |
-
Vulnerability Mmio stale data: Not affected
|
| 124 |
-
Vulnerability Reg file data sampling: Not affected
|
| 125 |
-
Vulnerability Retbleed: Not affected
|
| 126 |
-
Vulnerability Spec rstack overflow: Not affected
|
| 127 |
-
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
|
| 128 |
-
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
|
| 129 |
-
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
|
| 130 |
-
Vulnerability Srbds: Not affected
|
| 131 |
-
Vulnerability Tsa: Not affected
|
| 132 |
-
Vulnerability Tsx async abort: Not affected
|
| 133 |
-
Vulnerability Vmscape: Not affected
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
[
|
| 149 |
-
[
|
| 150 |
-
[
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
```
|
| 158 |
-
</details>
|
| 159 |
|
| 160 |
-
|
| 161 |
-
- [linoyts/6a3288ccfb114ff24a3885f5](https://huggingface.co/jobs/linoyts/6a3288ccfb114ff24a3885f5)
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
- ahead-of-time
|
| 4 |
- pytorch
|
| 5 |
+
- ltx-2.3
|
| 6 |
+
- zerogpu
|
| 7 |
library_name: diffusers
|
| 8 |
+
base_model: diffusers/LTX-2.3-Diffusers
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# LTX-2.3 Transformer — AOTI build (in-context, **STG-capable**)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
Ahead-of-time **precompiled** `transformer_blocks` of `LTX2VideoTransformer3DModel` for
|
| 14 |
+
**ZeroGPU (sm120 / cu130)**. Graph only (no weights) → works with base **and** distilled
|
| 15 |
+
LTX-2.3 and any **fused** LoRA. Dynamic over video/audio token counts.
|
| 16 |
|
| 17 |
+
This build compiles the **perturbation (STG) path as always-on tensor math**
|
| 18 |
+
(`torch.lerp(value, hidden_states, perturbation_mask)`), so ONE graph serves both
|
| 19 |
+
spatio-temporal-guidance (STG) and non-STG: `lerp(·, ·, ones)` is a no-op, and the real
|
| 20 |
+
mask blends at the STG block. Use this for the **base-model demos that keep STG**
|
| 21 |
+
(`stg_scale>0`, default `spatio_temporal_guidance_blocks=[28]`) — e.g. beard-removal,
|
| 22 |
+
day-to-night, reference-sheet. (Non-STG demos can use the plain Group A repo.)
|
|
|
|
| 23 |
|
| 24 |
+
## Use it (ZeroGPU) — load at the **root module level** + a small STG wrapper
|
| 25 |
+
```python
|
| 26 |
+
import spaces, torch
|
| 27 |
from diffusers import LTX2InContextPipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
pipe = LTX2InContextPipeline.from_pretrained(
|
| 30 |
+
"diffusers/LTX-2.3-Diffusers", torch_dtype=torch.bfloat16).to("cuda")
|
| 31 |
+
pipe.load_lora_weights(my_lora_state_dict, adapter_name="x")
|
| 32 |
+
pipe.fuse_lora(lora_scale=1.0); pipe.unload_lora_weights()
|
| 33 |
+
spaces.aoti_load(module=pipe.transformer, repo_id="ltx-community/LTX-2.3-Transformer-GroupC-STG-sm120-cu130-rb3")
|
| 34 |
+
|
| 35 |
+
# the compiled graph always runs the perturbation lerp, so feed a no-op ones mask when the
|
| 36 |
+
# transformer passes None (non-STG blocks / main pass); the STG pass still passes the real
|
| 37 |
+
# mask to block 28. Also force all_perturbed=False (the python skip-attention shortcut is gone).
|
| 38 |
+
for _blk in pipe.transformer.transformer_blocks:
|
| 39 |
+
_c = _blk.forward
|
| 40 |
+
def _fwd(*a, _c=_c, **kw):
|
| 41 |
+
if kw.get("perturbation_mask", None) is None:
|
| 42 |
+
_h = kw["hidden_states"]
|
| 43 |
+
kw["perturbation_mask"] = torch.ones((_h.shape[0],1,1), device=_h.device, dtype=_h.dtype)
|
| 44 |
+
kw["all_perturbed"] = False
|
| 45 |
+
return _c(*a, **kw)
|
| 46 |
+
_blk.forward = _fwd
|
| 47 |
+
|
| 48 |
+
@spaces.GPU
|
| 49 |
+
def generate(*args, **kwargs):
|
| 50 |
+
return pipe(*args, **kwargs)
|
| 51 |
```
|
|
|
|
| 52 |
|
| 53 |
+
Public repo (graph only) → no token. Built with the bundled `job.py` (env `LTX_STG=1`).
|
|
|