Downloads · 30 days
12
16% of all-time downloads
elismasilva/ltx2.3_image_custom_blocks
ltx2.3_image_custom_blocks is a text-to-image model from elismasilva. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
Custom Modular Diffusers blocks that extend LTX 2 Image with image-to-image, plus a unified AutoBlocks that folds text-to-image and img2img into a single pipeline. The workflow is chosen automatically from which input…
Downloads · 30 days
12
16% of all-time downloads
All-time downloads
73
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py80.6 KB · 91%
From the Hugging Face model README
Custom Modular Diffusers blocks that
extend LTX 2 Image with image-to-image, plus a unified AutoBlocks that folds text-to-image and img2img into a
single pipeline. The workflow is chosen automatically from which inputs you pass.
prompt -> text2image
prompt + image -> image2image (optional strength)
import torch
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained(
"elismasilva/ltx2.3_image_custom_blocks",
trust_remote_code=True,
)
pipe.load_components(
names=["text_encoder", "tokenizer", "connectors", "transformer", "vae", "scheduler"],
pretrained_model_name_or_path="elismasilva/ltx2.3-image-base",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
image = pipe(
prompt="a cinematic close-up portrait with crisp realistic detail",
height=704,
width=1280,
num_inference_steps=28,
guidance_scale=3.0,
output="images",
)[0]
image.save("ltx2_image_t2i.png")
Pass an image and optional strength to the same pipe:
import torch
from diffusers import ModularPipeline
from diffusers.utils import load_image
pipe = ModularPipeline.from_pretrained(
"elismasilva/ltx2.3_image_custom_blocks",
trust_remote_code=True,
)
pipe.load_components(
names=["text_encoder", "tokenizer", "connectors", "transformer", "vae", "scheduler"],
pretrained_model_name_or_path="elismasilva/ltx2.3-image-base",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
init_image = load_image("input.png")
result = pipe(
prompt="preserve the scene while restoring crisp natural detail",
image=init_image,
height=704,
width=1280,
num_inference_steps=28,
guidance_scale=3.0,
strength=0.20,
output="images",
)[0]
result.save("ltx2_image_i2i.png")
The unified pipeline is composed of six modular blocks:
LTX2ImageTextEncoderStep encodes prompts into packed per-layer Gemma hidden states.LTX2ImageConnectorStep adapts those hidden states with the image text connectors.LTX2ImageVaeEncoderStep optionally encodes an input image for img2img.LTX2ImagePrepareLatentsStep prepares one-frame image latents and FlowMatch timesteps.LTX2ImageDenoiseStep runs the LTX 2 Image denoising loop.LTX2ImageDecodeStep decodes latents into images or returns latent output.The blocks expect the following components from elismasilva/ltx2.3-image-base:
text_encodertokenizerconnectorstransformervaeschedulerThe pipeline supports prompt embeds, custom sigmas or timesteps, guidance_scale, guidance_rescale, PAG inputs
(pag_scale and pag_applied_layers), and VAE decode controls (decode_timestep and decode_noise_scale). For img2img,
input_noise_sigma, input_sharpen, phase_cutoff, phase_transition_width, and phase_pad_factor can be used when
you need more control over how the input image is converted into latents.