Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: LTX-2.5 GGUF quants (unsloth/LTX-2.5-GGUF) (#13573)

Daniel Hanc35052e42fc1
diff --git a/studio/backend/core/inference/local_model_resolver.py b/studio/backend/core/inference/local_model_resolver.py
index 899f934be88..ad5e2c2a79a 100644
--- a/studio/backend/core/inference/local_model_resolver.py
+++ b/studio/backend/core/inference/local_model_resolver.py
@@ -426,13 +426,18 @@ def _local_gguf_entry(
# and then OOM.
from core.inference.openai_auto_download import preferred_quant
- # Rank the ROOT checkpoints alone when there are any. A plain local load resolves through non-recursive
- # detect_gguf_model and so always takes the repo root, while preferred_quant ranks on the key text and would
- # hand a bare id an equally-good ``distilled/...`` row that sorts earlier -- the same id serving different
- # weights depending on which resolver answered it. The qualified rows stay advertised; they are not what a bare
- # id means.
- unqualified = tuple(q for q in quants if "/" not in q)
- best = preferred_quant(unqualified or quants)
+ # preferred_quant is order-sensitive: rank only default_gguf_scope, or a sibling checkpoint can win.
+ from hub.utils.gguf import default_gguf_scope
+
+ best = preferred_quant(
+ default_gguf_scope(
+ quants,
+ getattr(info, "id", None),
+ getattr(info, "model_id", None),
+ loader_id,
+ str(cache_repo_dir) if cache_repo_dir is not None else None,
+ )
+ )
if best and quants[0] != best:
quants = (best, *(q for q in quants if q != best))
return _LocalGgufEntry(
diff --git a/studio/backend/core/inference/media_model_index.py b/studio/backend/core/inference/media_model_index.py
index 3996669fe92..83121d0fa25 100644
--- a/studio/backend/core/inference/media_model_index.py
+++ b/studio/backend/core/inference/media_model_index.py
@@ -175,11 +175,12 @@ def _add_gguf_picks(
A bare id means the quant a plain load takes, ranked by the ``preferred_quant`` the chat
resolver and /v1/models already share, so one id cannot mean different weights per surface.
- Root checkpoints are ranked alone when there are any: a plain local load resolves
- non-recursively and always takes the root, so ranking a qualified ``distilled/...`` build
- alongside them would let one id mean different weights here than in the picker.
+ Only the checkpoints ``default_gguf_scope`` names are ranked (the root ones when there are
+ any, or a curated repo's default subdirectory such as unsloth/LTX-2.5-GGUF's distilled/), so
+ one id cannot mean different weights here than in the picker.
"""
from core.inference.openai_auto_download import preferred_quant
+ from hub.utils.gguf import default_gguf_scope
from utils.models.model_config import list_local_gguf_variants
if load_dir.is_file():
@@ -217,8 +218,8 @@ def _add_gguf_picks(
[f"{key}:{quant}" for key in keys],
MediaModelPick(keys[0], load_path, variant.filename, "gguf"),
)
- unqualified = [quant for quant in openable if "/" not in quant]
- best = preferred_quant(unqualified or list(openable)) or next(iter(unqualified or openable))
+ scope = default_gguf_scope(list(openable), *keys, getattr(info, "id", None), str(on_disk))
+ best = preferred_quant(scope) or scope[0]
_register(
index,
keys,
diff --git a/studio/backend/core/inference/openai_auto_download.py b/studio/backend/core/inference/openai_auto_download.py
index f91d81661ff..c52add2b1d7 100644
--- a/studio/backend/core/inference/openai_auto_download.py
+++ b/studio/backend/core/inference/openai_auto_download.py
@@ -752,7 +752,7 @@ async def _admit_and_start(
),
)
- variant = _match_variant(wanted_variant, variants)
+ variant = _match_variant(wanted_variant, variants, repo_id)
if variant is None:
_release(active)
listed = sorted(variants)
@@ -906,7 +906,11 @@ def _bare_quant_alias(wanted: str, lowered: dict[str, str]) -> Optional[str]:
return matches[0] if len(matches) == 1 else None
-def _match_variant(wanted: Optional[str], variants: dict[str, int]) -> Optional[str]:
+def _match_variant(
+ wanted: Optional[str],
+ variants: dict[str, int],
+ repo_id: Optional[str] = None,
+) -> Optional[str]:
"""Resolve the requested quant against what the repo actually has.
An explicit quant matches case-insensitively and must exist: never quietly
@@ -928,13 +932,10 @@ def _match_variant(wanted: Optional[str], variants: dict[str, int]) -> Optional[
if exact is not None or looks_like_quant(wanted):
# A quant-shaped suffix that matches nothing is a miss, never a swap.
return exact
- # A BARE org/repo means the ROOT checkpoint, so a qualified sibling must not be ranked against it: preferred_quant
- # is order-sensitive, and once the map carried a key per checkpoint a repo with distilled/model-Q6_K beside
- # model-Q6_K could serve the sibling for a bare id -- the same id that resolves to the root locally. Same filter
- # local_model_resolver._local_gguf_entry applies, so both resolvers answer one id one way. A repo with nothing at
- # the root falls back to the whole set rather than refusing.
- unqualified = {name: size for name, size in variants.items() if "/" not in name}
- return preferred_quant(unqualified or variants)
+ # A bare id means default_gguf_scope, the same scope every resolver applies (preferred_quant is order-sensitive).
+ from hub.utils.gguf import default_gguf_scope
+
+ return preferred_quant(default_gguf_scope(variants, repo_id))
async def _dispatch(
diff --git a/studio/backend/core/inference/video.py b/studio/backend/core/inference/video.py
index ba364b9f96f..79b22bb5b05 100644
--- a/studio/backend/core/inference/video.py
+++ b/studio/backend/core/inference/video.py
@@ -278,6 +278,15 @@ from .family_profile import trusted_repo_ids as _trusted_repo_ids # noqa: E402
_TRUSTED_NON_GGUF_VIDEO_REPOS = _trusted_repo_ids(_VIDEO_REGISTRY)
+def _gguf_quant_token(filename: Optional[str]) -> Optional[str]:
+ """The quant a GGUF filename names (``Q4_K_M``, ``BF16``), as the status reports it in ``gguf_variant``."""
+ if not filename:
+ return None
+ from hub.utils.gguf import extract_quant_token
+
+ return extract_quant_token(filename)
+
+
def resolve_video_model_kind(gguf_filename: Optional[str], model_kind: Optional[str]) -> str:
"""Classify a load request; explicit model_kind wins, else the filename decides."""
if model_kind:
@@ -8083,6 +8092,13 @@ class VideoBackend:
"skipped: offload moves the DiT, unsupported for torchao "
"tensors; pin a resident memory mode to combine them"
if quant_skipped_for_offload
+ # Name the GGUF's quant: a BF16 GGUF is dense, so "quantized" would be wrong.
+ else (
+ "not engaged (GGUF DiT ("
+ + (_gguf_quant_token(gguf_filename) or "GGUF")
+ + ") loaded; the file's own weights are used as is)"
+ )
+ if kind == "gguf"
else "not engaged (dense bf16 DiT loaded)"
)
),
diff --git a/studio/backend/core/inference/video_families.py b/studio/backend/core/inference/video_families.py
index bf01a9804d2..895d1b6a343 100644
--- a/studio/backend/core/inference/video_families.py
+++ b/studio/backend/core/inference/video_families.py
@@ -83,7 +83,8 @@ def unsupported_ltx_version(*names: Optional[str]) -> Optional[str]:
def unsupported_ltx_message(version: str, subject: str) -> str:
return (
f"{subject} is LTX-{version}, which Studio does not support yet. Studio runs LTX-2.0 / LTX-2.3 "
- "(Lightricks/LTX-2.3 or unsloth/LTX-2.3-GGUF) and LTX-2.5 (Lightricks/LTX-2.5-Diffusers)."
+ "(Lightricks/LTX-2.3 or unsloth/LTX-2.3-GGUF) and LTX-2.5 (Lightricks/LTX-2.5-Diffusers or "
+ "unsloth/LTX-2.5-GGUF)."
)
@@ -288,6 +289,10 @@ class VideoFamily:
filter_reduction_configs_archs: tuple[tuple[int, int], ...] = field(default_factory = tuple)
# Curated GGUF repo for the picker (the DiT as single-file GGUF quants).
gguf_repo: Optional[str] = None
+ # Subdirectory of gguf_repo a bare repo id means; None keeps the root.
+ gguf_default_subdir: Optional[str] = None
+ # Picker label for root files when they differ from gguf_default_subdir ("UD-Q4_K_XL · dev").
+ gguf_root_label: Optional[str] = None
# Hosted PRE-CAST text-encoder checkpoints as (scheme, component, repo_id); same semantics as
# DiffusionFamily.te_prequant_repos.
te_prequant_repos: tuple[tuple[str, str, str], ...] = field(default_factory = tuple)
@@ -596,6 +601,11 @@ _FAMILIES: tuple[VideoFamily, ...] = (
),
# File sizes (decimal GB): int8 keeps the audio stream, AV cross-attention and adaLN in bf16; fp8 quantizes them.
prequant_resident_gb_by_scheme = (("int8", 25.11), ("fp8", 19.06)),
+ # Dev DiT at the root, distilled under distilled/; the pack above supplies VAEs and connectors.
+ gguf_repo = "unsloth/LTX-2.5-GGUF",
+ # Family defaults (8 + 3 steps, CFG 1) are the distilled DiT's.
+ gguf_default_subdir = "distilled",
+ gguf_root_label = "dev",
supports_keyframes = True,
accepts_last_frame = False,
# Same DiT layout as LTX-2.3, so the same measured knobs.
@@ -995,6 +1005,28 @@ def detect_video_family(repo_id: str, override: Optional[str] = None) -> Optiona
return fam
+def gguf_default_subdir_for_repo(repo_id: Optional[str]) -> Optional[str]:
+ """The ``gguf_default_subdir`` of the family whose curated ``gguf_repo`` is *repo_id*, or None."""
+ needle = (repo_id or "").strip().casefold()
+ if not needle:
+ return None
+ for fam in _FAMILIES:
+ if fam.gguf_repo and fam.gguf_default_subdir and fam.gguf_repo.casefold() == needle:
+ return fam.gguf_default_subdir
+ return None
+
+
+def gguf_root_label_for_repo(repo_id: Optional[str]) -> Optional[str]:
+ """The ``gguf_root_label`` of the family whose curated ``gguf_repo`` is *repo_id*, or None."""
+ needle = (repo_id or "").strip().casefold()
+ if not needle:
+ return None
+ for fam in _FAMILIES:
+ if fam.gguf_repo and fam.gguf_root_label and fam.gguf_repo.casefold() == needle:
+ return fam.gguf_root_label
+ return None
+
+
def supported_video_family_names() -> tuple[str, ...]:
return tuple(fam.name for fam in _FAMILIES)
diff --git a/studio/backend/hub/services/models/gguf_variants.py b/studio/backend/hub/services/models/gguf_variants.py
index 328fbbcfb63..a682dc0a89a 100644
--- a/studio/backend/hub/services/models/gguf_variants.py
+++ b/studio/backend/hub/services/models/gguf_variants.py
@@ -43,6 +43,7 @@ from hub.utils.gguf import (
list_gguf_variants,
list_local_gguf_variants,
list_partial_gguf_variants_from_state,
+ default_gguf_scope,
pick_best_gguf,
merge_sibling_snapshot_variants,
select_gguf_cache_snapshot,
@@ -1066,18 +1067,12 @@ class VariantsAnswer(NamedTuple):
variant_context_sources: Optional[dict[str, str]] = None
-def _default_variant_candidates(variants) -> list[str]:
- """The filenames the automatic default may be picked from: ROOT rows when there are any.
+def _default_variant_candidates(variants, repo_id: Optional[str] = None) -> list[str]:
+ """Filenames the automatic default may be picked from: ``default_gguf_scope`` of the rows.
- ``pick_best_gguf`` keeps whichever filename it met first among equals, so a repo with
- ``model-Q6_K.gguf`` beside ``distilled/model-Q6_K.gguf`` could make the qualified sibling the
- default -- and then a bare repo id would mean one checkpoint here and another to
- ``_match_variant(None, ...)`` and ``local_model_resolver``, which both define it as the root.
- Every branch of this service (remote, cached, partial-local) has to apply it, or the answer
- depends on which one served the request. Nothing at the root falls back to the whole set.
+ Every branch here must apply it: ``pick_best_gguf`` is order-sensitive among equal siblings.
"""
- root_rows = [v.filename for v in variants if "/" not in v.quant]
- return root_rows or [v.filename for v in variants]
+ return [v.filename for v in default_gguf_scope(variants, repo_id, key = lambda v: v.quant)]
async def _audio_cpp_variants_answer(
@@ -1320,7 +1315,7 @@ async def get_gguf_variants_answer(
# The default comes from the ready rows; with none ready every row is the fallback.
ready = [v for v in variants if _downloaded(v)]
- best = pick_best_gguf(_default_variant_candidates(ready or variants))
+ best = pick_best_gguf(_default_variant_candidates(ready or variants, repo_id))
default_variant = gguf_variant_key(best) if best else None
return GgufVariantsResponse(
@@ -1352,7 +1347,7 @@ async def get_gguf_variants_answer(
def _partial_local_response(
response_repo_id: str, variants, has_vision: bool
) -> GgufVariantsResponse:
- best = pick_best_gguf(_default_variant_candidates(variants))
+ best = pick_best_gguf(_default_variant_candidates(variants, repo_id))
default_variant = gguf_variant_key(best) if best else None
return GgufVariantsResponse(
repo_id = response_repo_id,
@@ -1511,7 +1506,7 @@ async def get_gguf_variants_answer(
return response
variants.extend(extra)
ready = [v for v in variants if v.downloaded and not v.partial]
- best = pick_best_gguf(_default_variant_candidates(ready or variants))
+ best = pick_best_gguf(_default_variant_candidates(ready or variants, repo_id))
default_variant = gguf_variant_key(best) if best else None
return response.model_copy(
update = {
@@ -1784,7 +1779,7 @@ async def get_gguf_variants_answer(
if fallback is not None:
return fallback
- best = pick_best_gguf(_default_variant_candidates(variants))
+ best = pick_best_gguf(_default_variant_candidates(variants, repo_id))
default_variant = gguf_variant_key(best) if best else None
# Per-snapshot accounting: split GGUFs need every shard together, sizes are max across snapshots
@@ -2336,13 +2331,12 @@ async def get_gguf_variants_answer(
variants[key] = detail
response.variants = list(variants.values())
response.has_vision = response.has_vision or any(s.has_vision for s in sources.values())
- # Merging changes which rows are root-level, and _default_variant_candidates picks
- # among root rows, so a default chosen from the active cache alone can name the
- # wrong checkpoint once a remembered folder contributes a root row. A partial row
- # is not a load the picker may recommend while a ready row exists, so prefer ready.
+ # Merging changes the scope, so re-pick the default; prefer ready rows over partial ones.
if sources or not response.default_variant:
ready = [v for v in response.variants if v.downloaded and not v.partial]
- best = pick_best_gguf(_default_variant_candidates(ready or response.variants))
+ best = pick_best_gguf(
+ _default_variant_candidates(ready or response.variants, repo_id)
+ )
response.default_variant = gguf_variant_key(best) if best else None
if response.dependencies_resolved and locally_proven[0] is not None:
rows = frozenset(
diff --git a/studio/backend/hub/utils/gguf.py b/studio/backend/hub/utils/gguf.py
index 3ee869ecf37..4fe38ccefd1 100644
--- a/studio/backend/hub/utils/gguf.py
+++ b/studio/backend/hub/utils/gguf.py
@@ -317,6 +317,76 @@ def _first_mainline_loadable(names: list[str]) -> Optional[str]:
return next(iter(loadable or names), None)
+def _repo_id_of(name: object) -> Optional[str]:
+ """*name* as an ``org/repo`` id when it reads as one: a repo id, or an HF cache ``models--org--repo`` folder."""
+ if not isinstance(name, str) or not name.strip():
+ return None
+ text = name.strip().rstrip("/\\")
+ for segment in reversed(re.split(r"[/\\]", text)):
+ if segment.startswith("models--"):
+ parts = segment[len("models--") :].split("--", 1)
+ return "/".join(parts) if len(parts) == 2 and all(parts) else None
+ return text
+
+
+def _repo_id_candidates(name: object) -> list:
+ """``_repo_id_of(name)``, plus the trailing ``org/repo`` of a plain local clone such as
+ ``/models/unsloth/LTX-2.5-GGUF``, so a copied curated repo keeps its per-repo defaults."""
+ rid = _repo_id_of(name)
+ out = [rid] if rid else []
+ if rid and rid == str(name).strip().rstrip("/\\"):
+ segments = [s for s in re.split(r"[/\\]", rid) if s]
+ tail = "/".join(segments[-2:])
+ if len(segments) >= 2 and tail != rid:
+ out.append(tail)
+ return out
+
+
+def default_gguf_subdir(*repo_ids: object) -> Optional[str]:
+ """The subdirectory a bare id of *repo_ids* defaults to (``VideoFamily.gguf_default_subdir``), or None."""
+ from core.inference.video_families import gguf_default_subdir_for_repo
+
+ for name in repo_ids:
+ for rid in _repo_id_candidates(name):
+ subdir = gguf_default_subdir_for_repo(rid)
+ if subdir:
+ return subdir
+ return None
+
+
+def gguf_root_label(*repo_ids: object) -> Optional[str]:
+ """``VideoFamily.gguf_root_label`` for *repo_ids*, else None."""
+ from core.inference.video_families import gguf_root_label_for_repo
+
+ for name in repo_ids:
+ for rid in _repo_id_candidates(name):
+ label = gguf_root_label_for_repo(rid)
+ if label:
+ return label
+ return None
+
+
+def default_gguf_scope(
+ items: Iterable,
+ *repo_ids: object,
+ key = None,
+) -> list:
+ """The *items* a bare repo id may default to: the default subdirectory's rows, else root rows, else all.
+
+ Every resolver of a bare id uses this one rule so one id names one checkpoint everywhere.
+ """
+ rows = list(items)
+ key_of = key or (lambda item: item)
+ subdir = default_gguf_subdir(*repo_ids)
+ if subdir:
+ prefix = subdir.strip("/").casefold() + "/"
+ scoped = [item for item in rows if str(key_of(item) or "").casefold().startswith(prefix)]
+ if scoped:
+ return scoped
+ root = [item for item in rows if "/" not in str(key_of(item) or "")]
+ return root or rows
+
+
def _gguf_stem(filename: str) -> str:
basename = filename.rsplit("/", 1)[-1]
return _GGUF_SPLIT_SUFFIX_RE.sub("", basename.rsplit(".", 1)[0]).strip()
@@ -803,7 +873,9 @@ def _variant_scope_label(filename: str, *, with_stem: bool = False) -> str:
return f"{parents}/{stem}" if with_stem else parents
-def _apply_gguf_display_labels(variants: list[GgufVariantInfo]) -> None:
+def _apply_gguf_display_labels(variants: list[GgufVariantInfo], *repo_ids: object) -> None:
+ """Fill ``display_label`` where the key alone does not say which checkpoint a row is."""
+ root_label = gguf_root_label(*repo_ids) if repo_ids else None
unknown_variants = [
variant for variant in variants if extract_quant_token(variant.filename) is None
]
@@ -843,6 +915,9 @@ def _apply_gguf_display_labels(variants: list[GgufVariantInfo]) -> None:
variant.display_label = (
f"{token} · {_variant_scope_label(variant.filename, with_stem = collides)}"
)
+ elif root_label and "/" not in variant.filename.replace("\\", "/"):
+ # Else the root quant reads as the default checkpoint.
+ variant.display_label = f"{variant.quant} · {root_label}"
def group_gguf_variant_files(entries) -> dict[str, tuple[str, int]]:
@@ -1027,7 +1102,7 @@ def merge_sibling_snapshot_variants(
whole.add(key)
if changed:
# Labels disambiguate within a revision, so a merged set can hold names only the merge brings together.
- _apply_gguf_display_labels(merged)
+ _apply_gguf_display_labels(merged, repo_id)
return merged, has_vision or any(merged_vision.values()), merged_complete, snapshot
@@ -1137,7 +1212,7 @@ def list_partial_gguf_variants_from_state(
)
variants.sort(key = lambda variant: -variant.size_bytes)
- _apply_gguf_display_labels(variants)
+ _apply_gguf_display_labels(variants, repo_id)
return variants, has_vision
@@ -1247,7 +1322,7 @@ def list_gguf_variants(
]
variants.sort(key = lambda variant: -variant.size_bytes)
- _apply_gguf_display_labels(variants)
+ _apply_gguf_display_labels(variants, repo_id)
return variants, has_vision, list(info.siblings)
@@ -1339,5 +1414,5 @@ def list_local_gguf_variants(
for quant, (filename, size) in group_gguf_variant_files(main_files).items()
]
variants.sort(key = lambda variant: -variant.size_bytes)
- _apply_gguf_display_labels(variants)
+ _apply_gguf_display_labels(variants, directory, model_root)
return variants, has_vision
diff --git a/studio/backend/tests/test_gguf_variant_rows.py b/studio/backend/tests/test_gguf_variant_rows.py
index 863f1224295..2f5a932c201 100644
--- a/studio/backend/tests/test_gguf_variant_rows.py
+++ b/studio/backend/tests/test_gguf_variant_rows.py
@@ -14,6 +14,7 @@ Splitting a genuinely split GGUF is the opposite mistake, so both are pinned her
from __future__ import annotations
+import re
from pathlib import Path
import pytest
@@ -1109,8 +1110,8 @@ def test_the_remote_default_variant_prefers_the_root_checkpoint():
from hub.services.models import gguf_variants as service
source = inspect.getsource(service)
- assert 'root_rows = [v.filename for v in variants if "/" not in v.quant]' in source
- assert "pick_best_gguf(_default_variant_candidates(variants))" in source
+ assert "default_gguf_scope(variants, repo_id, key = lambda v: v.quant)" in source
+ assert "pick_best_gguf(_default_variant_candidates(variants, repo_id))" in source
def test_the_load_guard_sees_the_alias_the_delete_accepts():
@@ -1152,7 +1153,8 @@ def test_every_branch_derives_the_default_from_the_root_rows():
assert service._default_variant_candidates(rows[:1]) == ["distilled/model-Q6_K.gguf"]
# No branch may call pick_best_gguf on the raw filenames any more.
source = inspect.getsource(service)
- assert source.count("pick_best_gguf(_default_variant_candidates(") == 5
+ # Whitespace-insensitive: the formatter may wrap a call across lines.
+ assert len(re.findall(r"pick_best_gguf\(\s*_default_variant_candidates\(", source)) == 5
assert "pick_best_gguf(filenames)" not in source
@@ -1190,7 +1192,8 @@ def test_the_remote_load_path_auto_selects_the_root_checkpoint():
from utils.models import model_config as mc
source = inspect.getsource(mc.ModelConfig.from_identifier)
- assert "root_rows = [" in source
- assert "variant_filenames = root_rows or [v.filename for v in variants]" in source
+ # The shared scope (root rows, or a curated repo's default subdirectory) keyed on the bare id.
+ assert "for v in default_gguf_scope(" in source
+ assert "identifier," in source
# The filter reads the ADVERTISED identity, the same one the lister assigns each row.
- assert '"/" not in _qualified_variant_name(v.filename, v.quant)' in source
+ assert "key = lambda v: _qualified_variant_name(v.filename, v.quant)" in source
diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.py
index 5ca089c6cd0..b7c311bb9e3 100644
--- a/studio/backend/tests/test_video_backend.py
+++ b/studio/backend/tests/test_video_backend.py
@@ -2131,6 +2131,24 @@ def test_video_auto_toggle_not_armed_when_the_dit_cannot_cache(fake_runtime, tmp
backend.unload()
+def test_video_gguf_status_does_not_call_a_bf16_gguf_quantized(fake_runtime, tmp_path):
+ # unsloth/LTX-2.5-GGUF also ships a dense BF16 GGUF: the reason names the file's quant, not "quantized weights".
+ filename = "ltx-2.3-22b-distilled-1.1-BF16.gguf"
+ (tmp_path / filename).write_bytes(b"w")
+ backend = VideoBackend()
+ status = backend.load_pipeline(
+ str(tmp_path),
+ gguf_filename = filename,
+ base_repo = "Lightricks/LTX-2",
+ family_override = "ltx-2",
+ )
+ assert status["gguf_variant"] == "BF16"
+ reason = status["resolved"]["transformer_quant"]["reason"]
+ assert reason == "not engaged (GGUF DiT (BF16) loaded; the file's own weights are used as is)"
+ assert "quantized" not in reason
+ backend.unload()
+
+
def test_video_gguf_status_reports_selected_quant_instead_of_only_compute_dtype(
fake_runtime, tmp_path
):
@@ -2146,6 +2164,13 @@ def test_video_gguf_status_reports_selected_quant_instead_of_only_compute_dtype(
)
assert status["gguf_variant"] == "Q4_K_M"
+ # The DiT is the GGUF's own quantized weights, not a dense bf16 one.
+ quant = status["resolved"]["transformer_quant"]
+ assert (quant["value"], quant["source"]) == ("off", "auto")
+ assert (
+ quant["reason"]
+ == "not engaged (GGUF DiT (Q4_K_M) loaded; the file's own weights are used as is)"
+ )
assert backend.unload()["gguf_variant"] is None
# A pipeline load has no checkpoint quant to name.
assert (
diff --git a/studio/backend/tests/test_video_ltx25_gguf.py b/studio/backend/tests/test_video_ltx25_gguf.py
new file mode 100644
index 00000000000..7e962d4a98a
--- /dev/null
+++ b/studio/backend/tests/test_video_ltx25_gguf.py
@@ -0,0 +1,321 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""unsloth/LTX-2.5-GGUF: the LTX-2.5 DiT as single-file GGUF quants.
+
+Dev DiT at the root, distilled under ``distilled/``; header arch ``ltxv`` (shared with 2.3) with
+``model_version = 2.5.0``. Every file must load as ``ltx-2.5``, never down the 2.3 assembly.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pytest
+
+from core.inference.video_families import (
+ LTX25_FAMILY,
+ LTX2_FAMILY,
+ default_video_generation_params,
+ detect_video_family,
+)
+
+REPO = "unsloth/LTX-2.5-GGUF"
+PACK = "Lightricks/LTX-2.5-Diffusers"
+QUANTS = (
+ "Q2_K",
+ "Q3_K_M",
+ "Q4_K_M",
+ "Q5_K_M",
+ "Q6_K",
+ "Q8_0",
+ "BF16",
+ "UD-Q2_K_XL",
+ "UD-Q3_K_XL",
+ "UD-Q4_K_XL",
+ "UD-Q5_K_XL",
+)
+DEV_FILES = [f"ltx-2.5-22b-dev-{q}.gguf" for q in QUANTS]
+DISTILLED_FILES = [f"distilled/ltx-2.5-22b-distilled-{q}.gguf" for q in QUANTS]
+
+
+def test_the_family_curates_the_unsloth_gguf_repo():
+ fam = detect_video_family(PACK)
+ assert fam.name == LTX25_FAMILY
+ assert fam.gguf_repo == REPO
+ assert detect_video_family(REPO).name == LTX25_FAMILY
+ # 2.3 keeps its own repo.
+ assert detect_video_family("", override = LTX2_FAMILY).gguf_repo == "unsloth/LTX-2.3-GGUF"
+
+
[email protected]("filename", DEV_FILES + DISTILLED_FILES)
+def test_every_planned_file_routes_to_ltx25_with_its_variant_defaults(filename):
+ from core.inference.video import _detect_load_family, _ltx25_dev_load
+ from hub.utils.gguf import extract_quant_label
+
+ fam = _detect_load_family(REPO, filename, None)
+ assert fam.name == LTX25_FAMILY
+ dev = filename in DEV_FILES
+ assert _ltx25_dev_load(fam, "gguf", filename, REPO) is dev
+ expected = (30, 3.0) if dev else (8, 1.0)
+ assert (
+ default_video_generation_params(
+ None,
+ filename,
+ REPO,
+ fallback = (fam.default_steps, fam.default_guidance),
+ family = fam.name,
+ )
+ == expected
+ )
+ quant = filename.rsplit("-", 1)[-1][: -len(".gguf")]
+ if "UD-" in filename:
+ quant = "UD-" + quant
+ assert extract_quant_label(filename) == quant
+
+
[email protected]("filename", [DEV_FILES[2], DISTILLED_FILES[9]])
+def test_a_hub_pick_validates_on_the_pack_base_without_touching_the_hub(filename, monkeypatch):
+ from core.inference.video import get_video_backend
+ from core.inference.video_families import resolve_video_base_repo
+
+ monkeypatch.setenv("HF_HUB_OFFLINE", "1")
+ fam = get_video_backend().validate_load_request(REPO, gguf_filename = filename, model_kind = "gguf")
+ assert fam.name == LTX25_FAMILY
+ assert resolve_video_base_repo(fam, None, REPO) == PACK
+
+
+def test_a_25_file_in_the_23_repo_and_the_reverse_follow_the_file():
+ from core.inference.video import _detect_load_family
+ assert (
+ _detect_load_family("unsloth/LTX-2.3-GGUF", DISTILLED_FILES[2], None).name == LTX25_FAMILY
+ )
+ assert (
+ _detect_load_family(REPO, "distilled/ltx-2.3-22b-distilled-Q4_K_M.gguf", None).name
+ == LTX2_FAMILY
+ )
+
+
+def _write_gguf(path, *, v25: bool = True) -> None:
+ """A tiny GGUF with the planned header: arch ltxv, model_version / config KVs, bare Comfy DiT + connector keys."""
+ gguf = pytest.importorskip("gguf")
+ writer = gguf.GGUFWriter(str(path), "ltxv")
+ writer.add_quantization_version(2)
+ writer.add_file_type(15)
+ writer.add_string("model_version", "2.5.0" if v25 else "2.3.0")
+ writer.add_string("config", '{"transformer": {"_class_name": "AVTransformer3DModel"}}')
+ writer.add_string("gemma_source_checkpoint", '{"ltx_version": "2.5.0"}')
+ tensors = {
+ "scale_shift_table": (2, 64),
+ "patchify_proj.weight": (64, 128),
+ "audio_adaln_single.linear.weight": (64, 32),
+ "transformer_blocks.0.attn1.to_q.weight": (64, 64),
+ "transformer_blocks.0.ff.net.0.proj.weight": (128, 64),
+ "video_embeddings_connector.transformer_1d_blocks.0.attn1.to_q.weight": (64, 64),
+ }
+ if v25:
+ tensors["keyframes_abs_pos_embedding"] = (4, 64)
+ else:
+ tensors["transformer_blocks.0.ff.net.0.proj.bias"] = (128,)
+ for name, shape in tensors.items():
+ writer.add_tensor(name, np.zeros(shape, dtype = np.float32))
+ writer.write_header_to_file()
+ writer.write_kv_data_to_file()
+ writer.write_tensors_to_file()
+ writer.close()
+
+
+def test_the_planned_header_reads_as_ltx25_even_renamed(tmp_path):
+ from core.inference.diffusion_content import inspect_checkpoint
+ from core.inference.video import _detect_load_family, get_video_backend
+ from utils.models.gguf_metadata import read_gguf_architecture
+
+ root = tmp_path / "quants"
+ (root / "distilled").mkdir(parents = True)
+ renamed = root / "distilled" / "model-Q4_K_M.gguf"
+ _write_gguf(renamed)
+ _write_gguf(root / DEV_FILES[2])
+ assert read_gguf_architecture(str(renamed)) == "ltxv"
+ info = inspect_checkpoint(str(renamed))
+ assert info.family == LTX25_FAMILY and info.layout == "gguf"
+ # No version token anywhere in the path: the header decides, never the 2.3 alias "ltxv".
+ assert _detect_load_family(str(root), "distilled/model-Q4_K_M.gguf", None).name == LTX25_FAMILY
+ backend = get_video_backend()
+ for name in ("distilled/model-Q4_K_M.gguf", DEV_FILES[2]):
+ fam = backend.validate_load_request(str(root), gguf_filename = name, model_kind = "gguf")
+ assert fam.name == LTX25_FAMILY
+
+
+def test_a_23_header_never_loads_as_ltx25(tmp_path):
+ from core.inference.diffusion_content import inspect_checkpoint
+
+ path = tmp_path / "model-Q4_K_M.gguf"
+ _write_gguf(path, v25 = False)
+ assert inspect_checkpoint(str(path)).family == LTX2_FAMILY
+
+
+def test_picker_rows_keep_dev_and_distilled_apart_and_rank_ud_first():
+ from hub.utils.gguf import gguf_variant_key, pick_best_gguf
+
+ keys = {gguf_variant_key(f) for f in DEV_FILES + DISTILLED_FILES}
+ assert len(keys) == len(DEV_FILES) + len(DISTILLED_FILES)
+ # Within each checkpoint UD-Q4_K_XL ranks first, then Q4_K_M; which checkpoint a bare id means is
+ # default_gguf_scope's call (the next test).
+ assert pick_best_gguf(DEV_FILES) == "ltx-2.5-22b-dev-UD-Q4_K_XL.gguf"
+ assert pick_best_gguf([f for f in DEV_FILES if "UD-" not in f]) == "ltx-2.5-22b-dev-Q4_K_M.gguf"
+ assert pick_best_gguf(DISTILLED_FILES) == "distilled/ltx-2.5-22b-distilled-UD-Q4_K_XL.gguf"
+
+
+DISTILLED_DEFAULT = "distilled/ltx-2.5-22b-distilled-UD-Q4_K_XL.gguf"
+DISTILLED_DEFAULT_KEY = "distilled/ltx-2.5-22b-distilled-UD-Q4_K_XL"
+
+
+def _rows(files):
+ import types
+
+ from hub.utils.gguf import gguf_variant_key
+ return [types.SimpleNamespace(filename = f, quant = gguf_variant_key(f)) for f in files]
+
+
[email protected]("order", ["dev_first", "distilled_first"])
+def test_bare_repo_id_defaults_to_the_distilled_ud_q4_k_xl(order):
+ """The bare-repo /gguf-variants default is distilled/...-UD-Q4_K_XL, whatever the listing order."""
+ from hub.services.models.gguf_variants import _default_variant_candidates
+ from hub.utils.gguf import pick_best_gguf
+
+ files = DEV_FILES + DISTILLED_FILES if order == "dev_first" else DISTILLED_FILES + DEV_FILES
+ rows = _rows(files)
+ assert pick_best_gguf(_default_variant_candidates(rows, REPO)) == DISTILLED_DEFAULT
+ assert pick_best_gguf(_default_variant_candidates(rows, REPO.lower())) == DISTILLED_DEFAULT
+ # Only dev downloaded: the scope falls back to the root rows rather than answering nothing.
+ assert pick_best_gguf(_default_variant_candidates(_rows(DEV_FILES), REPO)) == (
+ "ltx-2.5-22b-dev-UD-Q4_K_XL.gguf"
+ )
+
+
+def test_every_bare_id_resolver_agrees_on_distilled():
+ """_match_variant(None, ...) (OpenAI-style auto-download) and the shared scope used by local_model_resolver and the
+ media index name the same distilled checkpoint; an explicit dev variant still loads dev."""
+ from core.inference.openai_auto_download import _match_variant, preferred_quant
+ from hub.utils.gguf import default_gguf_scope, gguf_variant_key
+
+ sizes = {gguf_variant_key(f): 1 for f in DEV_FILES + DISTILLED_FILES}
+ assert _match_variant(None, sizes, REPO) == DISTILLED_DEFAULT_KEY
+ assert _match_variant("UD-Q4_K_XL", sizes, REPO) == "UD-Q4_K_XL"
+ assert _match_variant("Q8_0", sizes, REPO) == "Q8_0"
+ # An HF cache folder names the repo as well as its id does.
+ cache_dir = "/cache/hub/models--unsloth--LTX-2.5-GGUF"
+ assert preferred_quant(default_gguf_scope(tuple(sizes), cache_dir)) == DISTILLED_DEFAULT_KEY
+
+
+def test_local_resolver_and_media_index_put_distilled_first(tmp_path, monkeypatch):
+ from types import SimpleNamespace
+
+ from core.inference import local_model_resolver as resolver
+ from core.inference import media_model_index as index_mod
+
+ folder = tmp_path / "models--unsloth--LTX-2.5-GGUF"
+ (folder / "distilled").mkdir(parents = True)
+ for name in ("Q4_K_M", "UD-Q4_K_XL"):
+ (folder / f"ltx-2.5-22b-dev-{name}.gguf").write_bytes(b"GGUF" + b"\0" * 64)
+ (folder / "distilled" / f"ltx-2.5-22b-distilled-{name}.gguf").write_bytes(
+ b"GGUF" + b"\0" * 64
+ )
+ info = SimpleNamespace(path = str(folder), id = REPO, model_id = REPO, display_name = None)
+ entry = resolver._local_gguf_entry(REPO, info)
+ assert entry is not None and entry.variants[0] == DISTILLED_DEFAULT_KEY
+
+ monkeypatch.setattr(index_mod, "_loader_can_open", lambda *_: True)
+ picks: dict = {}
+ assert index_mod._add_gguf_picks(picks, info, (REPO,), folder, folder)
+ # The index keys are lowercased.
+ assert picks[REPO.lower()].gguf_filename.replace("\\", "/") == DISTILLED_DEFAULT
+ assert picks[f"{REPO}:UD-Q4_K_XL".lower()].gguf_filename == "ltx-2.5-22b-dev-UD-Q4_K_XL.gguf"
+
+
+def test_ltx23_and_other_repos_keep_the_root_default():
+ from core.inference.openai_auto_download import _match_variant
+ from core.inference.video_families import gguf_default_subdir_for_repo
+ from hub.services.models.gguf_variants import _default_variant_candidates
+ from hub.utils.gguf import pick_best_gguf
+
+ assert gguf_default_subdir_for_repo(REPO) == "distilled"
+ assert gguf_default_subdir_for_repo("unsloth/LTX-2.3-GGUF") is None
+ files23 = [f.replace("2.5", "2.3") for f in DISTILLED_FILES + DEV_FILES]
+ assert pick_best_gguf(_default_variant_candidates(_rows(files23), "unsloth/LTX-2.3-GGUF")) == (
+ "ltx-2.3-22b-dev-UD-Q4_K_XL.gguf"
+ )
+ other = {"distilled/model-Q4_K_M": 1, "Q4_K_M": 1}
+ assert _match_variant(None, other, "unsloth/Qwen3-8B-GGUF") == "Q4_K_M"
+ assert _match_variant(None, other, None) == "Q4_K_M"
+
+
+def test_picker_labels_the_root_rows_dev_and_the_subfolder_rows_distilled(tmp_path):
+ """Root rows read "<quant> · dev" on every listing path; 2.3 and plain repos keep bare root rows."""
+ from hub.utils.gguf import (
+ GgufVariantInfo,
+ _apply_gguf_display_labels,
+ gguf_variant_key,
+ list_local_gguf_variants,
+ )
+
+ def labels(files, *repo):
+ rows = [GgufVariantInfo(filename = f, quant = gguf_variant_key(f), size_bytes = 1) for f in files]
+ _apply_gguf_display_labels(rows, *repo)
+ return {r.filename: r.display_label for r in rows}
+
+ got = labels(DEV_FILES + DISTILLED_FILES, REPO)
+ for q in QUANTS:
+ assert got[f"ltx-2.5-22b-dev-{q}.gguf"] == f"{q} · dev"
+ # Several rows share the distilled/ scope, so the existing rule adds the file stem to tell them apart.
+ assert got[f"distilled/ltx-2.5-22b-distilled-{q}.gguf"].startswith(f"{q} · distilled")
+ files23 = [f.replace("2.5", "2.3") for f in DEV_FILES + DISTILLED_FILES]
+ got23 = labels(files23, "unsloth/LTX-2.3-GGUF")
+ assert got23["ltx-2.3-22b-dev-UD-Q4_K_XL.gguf"] is None
+ assert got23["distilled/ltx-2.3-22b-distilled-UD-Q4_K_XL.gguf"].startswith(
+ "UD-Q4_K_XL · distilled"
+ )
+ assert labels(DEV_FILES)["ltx-2.5-22b-dev-Q8_0.gguf"] is None
+
+ # A cached snapshot is listed by directory: the repo is read off the models--org--repo segment.
+ snap = tmp_path / "models--unsloth--LTX-2.5-GGUF" / "snapshots" / "abc"
+ (snap / "distilled").mkdir(parents = True)
+ for name in (
+ "ltx-2.5-22b-dev-UD-Q4_K_XL.gguf",
+ "distilled/ltx-2.5-22b-distilled-UD-Q4_K_XL.gguf",
+ ):
+ (snap / name).write_bytes(b"GGUF" + b"\0" * 64)
+ variants, _ = list_local_gguf_variants(str(snap))
+ assert {v.quant: v.display_label for v in variants} == {
+ "UD-Q4_K_XL": "UD-Q4_K_XL · dev",
+ DISTILLED_DEFAULT_KEY: "UD-Q4_K_XL · distilled",
+ }
+
+
+def test_a_plain_local_clone_keeps_the_distilled_default_and_dev_labels(tmp_path):
+ """A plain local copy (``/models/unsloth/LTX-2.5-GGUF``) is recognised by its trailing org/repo."""
+ from hub.utils.gguf import default_gguf_subdir, gguf_root_label, list_local_gguf_variants
+
+ clone = tmp_path / "models" / "unsloth" / "LTX-2.5-GGUF"
+ (clone / "distilled").mkdir(parents = True)
+ for name in (
+ "ltx-2.5-22b-dev-UD-Q4_K_XL.gguf",
+ "distilled/ltx-2.5-22b-distilled-UD-Q4_K_XL.gguf",
+ ):
+ (clone / name).write_bytes(b"GGUF" + b"\0" * 64)
+ assert default_gguf_subdir(str(clone)) == "distilled"
+ assert gguf_root_label(str(clone)) == "dev"
+ assert default_gguf_subdir("C:\\models\\unsloth\\LTX-2.5-GGUF") == "distilled"
+ variants, _ = list_local_gguf_variants(str(clone))
+ assert {v.quant: v.display_label for v in variants} == {
+ "UD-Q4_K_XL": "UD-Q4_K_XL · dev",
+ DISTILLED_DEFAULT_KEY: "UD-Q4_K_XL · distilled",
+ }
+ # Unrelated folders and bare names keep the root default.
+ assert default_gguf_subdir(str(tmp_path / "models" / "other" / "Repo")) is None
+ assert default_gguf_subdir("LTX-2.5-GGUF") is None
+
+
+def test_unsupported_message_names_both_25_artifacts():
+ from core.inference.video_families import unsupported_ltx_message
+ text = unsupported_ltx_message("2.6", "x")
+ assert PACK in text and REPO in text and "unsloth/LTX-2.3-GGUF" in text
diff --git a/studio/backend/utils/models/model_config.py b/studio/backend/utils/models/model_config.py
index 6b1c8535d00..5e8a9be340b 100644
--- a/studio/backend/utils/models/model_config.py
+++ b/studio/backend/utils/models/model_config.py
@@ -3570,11 +3570,15 @@ def _refused_repo_cached_gguf(
# Auto: preferred variant first, falling through incomplete ones, across every snapshot.
remaining = sorted(_hf_cache_main_gguf_files(repo_id, every_snapshot = True))
while remaining:
- # Repo-root checkpoint first, as the healthy-Hub pick does.
- root_rows = [
- f for f in remaining if "/" not in _qualified_variant_name(f, _extract_quant_label(f))
- ]
- best = _pick_best_gguf(root_rows or remaining)
+ from hub.utils.gguf import default_gguf_scope
+
+ best = _pick_best_gguf(
+ default_gguf_scope(
+ remaining,
+ repo_id,
+ key = lambda f: _qualified_variant_name(f, _extract_quant_label(f)),
+ )
+ )
if not best:
return None
label = _extract_quant_label(best)
@@ -4806,17 +4810,17 @@ class ModelConfig:
f"Available variants: {available}"
)
if not variant: # auto-select best quant
- # ROOT rows when there are any. _pick_best_gguf keeps whichever filename it
- # met first among equals, so an LTX-style listing that puts distilled/...-Q6_K
- # before the root ...-Q6_K made a bare repo id load the distilled checkpoint --
- # while local_model_resolver, the auto-download map and /gguf-variants all
- # define a bare id as the root. This is the LOAD path, so it has to agree.
- root_rows = [
+ # _pick_best_gguf is order-sensitive: use the scope every resolver uses.
+ from hub.utils.gguf import default_gguf_scope
+
+ variant_filenames = [
v.filename
- for v in variants
- if "/" not in _qualified_variant_name(v.filename, v.quant)
+ for v in default_gguf_scope(
+ variants,
+ identifier,
+ key = lambda v: _qualified_variant_name(v.filename, v.quant),
+ )
]
- variant_filenames = root_rows or [v.filename for v in variants]
best = _pick_best_gguf(variant_filenames)
if best:
# The SAME identity the lister advertised for that file. Converting the
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
index 9b3f548597c..4cd50a1eff1 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
+++ b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
@@ -194,6 +194,18 @@ assert.equal(
assert.equal(curatedRowLabelFor("Lightricks/LTX-2.5-Diffusers", VIDEO_CATALOG, "accelerated")?.name, "LTX 2.5 distilled (Diffusers)");
assert.equal(curatedRowLabelFor("Lightricks/LTX-2.5-Diffusers", VIDEO_CATALOG, "gguf-only")?.name, "LTX 2.5 distilled (Diffusers)");
assert.equal(curatedRowLabelFor("Lightricks/LTX-2", VIDEO_CATALOG, "dense-quant", ["fp8"])?.name, "LTX 2 (base)");
+// The GGUF quants join the same group, never 2.3.
+assert.equal(groupForRepoId("unsloth/LTX-2.5-GGUF", VIDEO_CATALOG), ltx25);
+assert.equal(groupForRepoId("unsloth/ltx-2.5-gguf", VIDEO_CATALOG), ltx25);
+assert.notEqual(groupForRepoId("unsloth/LTX-2.5-GGUF", VIDEO_CATALOG), ltx23);
+assert.deepEqual(
+ ltx25.artifacts.map((a) => [a.repoId, a.loadKind]),
+ [
+ ["Lightricks/LTX-2.5-Diffusers", "pipeline"],
+ ["Lightricks/LTX-2.5", "single_file"],
+ ["unsloth/LTX-2.5-GGUF", "gguf"],
+ ],
+);
// SDXL Turbo and Base stay separate groups (different checkpoints).
assert.notEqual(
groupForRepoId("stabilityai/sdxl-turbo", IMAGE_CATALOG),
@@ -295,6 +307,8 @@ for (const id of [
const videoOptionIds = new Set(catalogToModelOptions(VIDEO_CATALOG).map((o) => o.id));
for (const id of [
"unsloth/LTX-2.3-GGUF",
+ "unsloth/LTX-2.5-GGUF",
+ "Lightricks/LTX-2.5-Diffusers",
"unsloth/MiniMax-H3-GGUF",
...OLD_PIPELINE_MODELS,
]) {
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
index 11e4a87f51c..7230f1cfa32 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
+++ b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
@@ -584,6 +584,8 @@ export const VIDEO_CATALOG: CatalogGroup[] = [
75,
{ label: "BF16 - Single file", gated: true, offloadFitTiers: LTX25_SINGLE_FILE_OFFLOAD_TIERS },
),
+ // 21.0B is every tensor of the single-file DiT the quants are cut from.
+ gguf("unsloth/LTX-2.5-GGUF", { totalParams: 21_004_025_600 }),
],
},
{