Instructions to use akrao9/Linarix-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use akrao9/Linarix-v2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("akrao9/Linarix-v2", 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
- Local Apps Settings
- Draw Things
- DiffusionBee
Linarix-v2
Usage
Requires
diffusers >= 0.38.0— earlier versions have atrust_remote_codeRCE (advisory). For production, pin a commit hash withrevision=so the remote code cannot change under you.
Install
pip install -U "diffusers>=0.38.0" transformers accelerate safetensors torchvision scipy
pip install "flash-linear-attention @ git+https://github.com/fla-org/flash-linear-attention.git@3c4c54ae7397d37130d7101edd0f4eb596af896d"
FLA is required, not optional: the GDN-2 mixers and Block AttnRes need this exact build.
Generate
import torch
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained(
"Akrao9/Linarix-v2",
custom_pipeline="pipeline_boomer",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipe("a lighthouse on a rocky cliff above crashing waves at golden hour")[0]
image.save("output.png")
Every sampler setting defaults to the value this model was tuned and showcased at
(STORK4, 20 steps, cfg_scale=4.0,
flow_shift=5.0), so passing nothing reproduces the grid above. Override
only what you want to change:
image = pipe(
"a quiet cobblestone street in an old European town, evening",
seed=42, # None (default) draws a fresh seed each call
cfg_scale=3.0, # lower = softer, less saturated; raise for prompt adherence
steps=32, # more steps buy little past the default
)[0]
The transformer weights come from this repo. The DC-AE VAE and Qwen/Qwen3.5-4B text
encoder are fetched from their upstream repos on first use — run hf auth login first
if this repo is gated for you.
Batched inference
Pass a list of prompts to generate a batch in one call:
images = pipe([
"a lighthouse above crashing waves",
"a red fox in fresh snow",
"a steam locomotive on a stone bridge",
])
images[0].save("a.png")
Two things matter for throughput. VAE slicing is on by default, decoding one image
at a time so batched-decode peak memory stays flat; toggle with
pipe.disable_vae_slicing(), or add pipe.enable_vae_tiling() for large images on low
VRAM (both work before the VAE is lazily loaded). And keep components resident on
the GPU when benchmarking — the default offload_text_encoder=True moves the text
encoder to CPU after each call, which is the right trade for VRAM but adds per-call
transfer overhead that dominates small batches.
Samples
All 1024px, EMA weights, STORK4 / 20 steps,
derivative_order=1, substeps=14,
cfg_scale=4.0, cfg_rescale=0.5,
cfg_interval=[0.1, 0.9], and
flow_shift=5.0. Prompts (left→right, top→bottom):
- a snow-covered mountain village at blue hour, warm windows glowing
- a desert canyon at sunset, layered red rock walls
- a wooden pier stretching into a misty lake at dawn
- a stone castle on a green hilltop under drifting clouds
- an elderly fisherman mending nets on a harbour wall
- a ginger cat asleep on a sunlit windowsill
- a vintage motorcycle parked on a rain-slicked city street at night
- a field of sunflowers under a bright summer sky
- a narrow canal in Venice with weathered facades, late afternoon
- a steaming bowl of ramen on a dark wooden table
- a great horned owl perched on a bare branch at dusk
- a glass greenhouse full of ferns, soft diffused light
- Downloads last month
- 26
