Add the Lumina Image 2.0 family to the image catalog
Alpha-VLLM/Lumina-Image-2.0 is a 2.6B single-stream DiT with a Gemma2-2B encoder and a standard 16-channel VAE, all transformers-4.x-compatible, so the generic from_pretrained pipeline path loads it as a new lumina-2 family: - Family entry (Lumina2Pipeline / Lumina2Transformer2DModel), aliased to lumina-image-2.0 / lumina-image-2 / lumina2. No bare lumina alias: Lumina-Next checkpoints are a different arch and must stay unknown rather than crash mid-load. bf16-only upstream, so the fp16 fallback stays off like z-image. - Trust the official repo for non-GGUF loads; bf16 component table entry (ships fp32, ~5.2 GB transformer + 5.2 GB encoder bf16-resident). - Generation defaults 50 steps / guidance 4.0 per the model card, and the generate call passes the card's cfg_trunc_ratio=0.25 itself (family-gated, signature-gated): the pipeline default (1.0) runs the CFG double-forward on every step and oversaturates output. - Catalog group with the single ungated bf16 pipeline artifact (11 GB resident) plus routing assertions; images page defaults row. - No GGUF artifact: none exists upstream (only finetune/LLM quants), so the dense transformer_quant fast path (GGUF-kind-only) stays unreachable for now. Offline probes of the future prequant campaign: int8 and fp8 both engage and render cleanly (fp8 LPIPS 0.11 vs bf16, int8 0.33 from 50-step trajectory drift with intact quality), so neither scheme is family-denied.
This commit is contained in:
parent
570cef6c79
commit
350e46bf2e
8 changed files with 145 additions and 0 deletions
|
|
@ -257,6 +257,7 @@ class _FakePipe:
|
|||
callback_on_step_end = None,
|
||||
guidance_scale = None,
|
||||
true_cfg_scale = None,
|
||||
cfg_trunc_ratio = None,
|
||||
**kwargs,
|
||||
):
|
||||
self.last_kwargs = {
|
||||
|
|
@ -265,6 +266,7 @@ class _FakePipe:
|
|||
"callback_on_step_end": callback_on_step_end,
|
||||
"guidance_scale": guidance_scale,
|
||||
"true_cfg_scale": true_cfg_scale,
|
||||
"cfg_trunc_ratio": cfg_trunc_ratio,
|
||||
**kwargs,
|
||||
}
|
||||
n = kwargs.get("num_images_per_prompt", 1)
|
||||
|
|
@ -406,6 +408,10 @@ def fake_runtime(monkeypatch):
|
|||
# that to a fake pipe so the guidance path is reachable without real weights.
|
||||
diffusers.Ideogram4Pipeline = _FakePipeline
|
||||
diffusers.Ideogram4Transformer2DModel = _FakeTransformer
|
||||
# Lumina 2, so the cfg_trunc_ratio special case is exercisable (the fake pipe's
|
||||
# signature carries the kwarg, mirroring the real Lumina2Pipeline).
|
||||
diffusers.Lumina2Pipeline = _FakePipeline
|
||||
diffusers.Lumina2Transformer2DModel = _FakeTransformer
|
||||
# SDXL: a U-Net family. Its single-file checkpoint is the whole pipeline, so the pipeline
|
||||
# class carries from_single_file; UNet2DConditionModel is the denoiser class (fetched but
|
||||
# unused on the pipeline/single-file-pipeline paths).
|
||||
|
|
@ -1755,6 +1761,41 @@ def test_generate_ideogram_custom_guidance_nulls_schedule(fake_runtime, tmp_path
|
|||
assert "guidance_schedule" in call and call["guidance_schedule"] is None
|
||||
|
||||
|
||||
def _load_lumina(backend, tmp_path):
|
||||
# Lumina 2 loads through the GENERIC pipeline path (standard diffusers layout);
|
||||
# a local pipeline dir is enough here.
|
||||
(tmp_path / "model_index.json").write_text("{}")
|
||||
backend.load_pipeline(str(tmp_path), family_override = "lumina-2")
|
||||
|
||||
|
||||
def test_generate_lumina2_passes_cfg_trunc_ratio(fake_runtime, tmp_path):
|
||||
# The card recipe truncates the CFG double-forward to the first quarter of the
|
||||
# trajectory; the pipeline default (1.0) applies it everywhere. The backend passes
|
||||
# the constant card value on every lumina-2 generate.
|
||||
backend = DiffusionBackend()
|
||||
_load_lumina(backend, tmp_path)
|
||||
backend.generate(prompt = "a sloth", steps = 50, guidance = 4.0)
|
||||
call = backend._state.pipe.last_kwargs
|
||||
assert call["cfg_trunc_ratio"] == 0.25
|
||||
assert call["guidance_scale"] == 4.0
|
||||
|
||||
|
||||
def test_generate_other_family_never_passes_cfg_trunc_ratio(fake_runtime, tmp_path):
|
||||
# The kwarg is family-gated, not just signature-gated: another family whose pipeline
|
||||
# happens to accept cfg_trunc_ratio must not inherit Lumina's recipe constant.
|
||||
backend = DiffusionBackend()
|
||||
(tmp_path / "model.gguf").write_bytes(b"weights")
|
||||
backend.load_pipeline(
|
||||
str(tmp_path),
|
||||
gguf_filename = "model.gguf",
|
||||
base_repo = "base/repo",
|
||||
family_override = "z-image",
|
||||
)
|
||||
backend.generate(prompt = "a sloth", steps = 9, guidance = 0.0)
|
||||
call = backend._state.pipe.last_kwargs
|
||||
assert call["cfg_trunc_ratio"] is None
|
||||
|
||||
|
||||
def test_begin_load_rejects_concurrent(monkeypatch):
|
||||
backend = DiffusionBackend()
|
||||
# The worker resolves the base + downloads, both over the network; stub them
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue