Skip to content

Commit 144769c

Browse files
committed
model_loader: add support for LTXV 0.9.7 distilled.
1 parent f01b2db commit 144769c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/ltxv_trainer/model_loader.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class LtxvModelVersion(str, Enum):
2828
LTXV_2B_096_DEV = "LTXV_2B_0.9.6_DEV"
2929
LTXV_2B_096_DISTILLED = "LTXV_2B_0.9.6_DISTILLED"
3030
LTXV_13B_097_DEV = "LTXV_13B_097_DEV"
31+
LTXV_13B_097_DISTILLED = "LTXV_13B_097_DISTILLED"
3132

3233
def __str__(self) -> str:
3334
"""Return the version string."""
@@ -54,10 +55,12 @@ def hf_repo(self) -> str:
5455
raise ValueError("LTXV_2B_096_DISTILLED does not have a HuggingFace repo")
5556
case LtxvModelVersion.LTXV_13B_097_DEV:
5657
raise ValueError("LTXV_13B_097_DEV does not have a HuggingFace repo")
58+
case LtxvModelVersion.LTXV_13B_097_DISTILLED:
59+
raise ValueError("LTXV_13B_097_DISTILLED does not have a HuggingFace repo")
5760
raise ValueError(f"Unknown version: {self}")
5861

5962
@property
60-
def safetensors_url(self) -> str:
63+
def safetensors_url(self) -> str: # noqa: PLR0911
6164
"""Get the safetensors URL for this version."""
6265
match self:
6366
case LtxvModelVersion.LTXV_2B_090:
@@ -72,6 +75,8 @@ def safetensors_url(self) -> str:
7275
return "https://huggingface.co/Lightricks/LTX-Video/blob/main/ltxv-2b-0.9.6-distilled-04-25.safetensors"
7376
case LtxvModelVersion.LTXV_13B_097_DEV:
7477
return "https://huggingface.co/Lightricks/LTX-Video/blob/main/ltxv-13b-0.9.7-dev.safetensors"
78+
case LtxvModelVersion.LTXV_13B_097_DISTILLED:
79+
return "https://huggingface.co/Lightricks/LTX-Video/blob/main/ltxv-13b-0.9.7-distilled.safetensors"
7580
raise ValueError(f"Unknown version: {self}")
7681

7782

@@ -160,14 +165,15 @@ def load_vae(
160165

161166
if isinstance(source, LtxvModelVersion):
162167
# NOTE: LTXV_2B_095's VAE must be loaded from the Diffusers folder-format instead of safetensors
163-
# This is a special case also for LTXV_2B_096_DEV and LTXV_13B_097_DEV which
168+
# This is a special case also for LTXV_2B_096_DEV and LTXV_13B_097_* which
164169
# don't have standalone HuggingFace repos, but share the same VAE as LTXV_2B_095.
165170
# Remove this once Diffusers properly supports loading from the safetensors file.
166171
if source in (
167172
LtxvModelVersion.LTXV_2B_095,
168173
LtxvModelVersion.LTXV_2B_096_DEV,
169174
LtxvModelVersion.LTXV_2B_096_DISTILLED,
170175
LtxvModelVersion.LTXV_13B_097_DEV,
176+
LtxvModelVersion.LTXV_13B_097_DISTILLED,
171177
):
172178
return AutoencoderKLLTXVideo.from_pretrained(
173179
LtxvModelVersion.LTXV_2B_095.hf_repo,
@@ -216,7 +222,10 @@ def load_transformer(
216222

217223
if isinstance(source, LtxvModelVersion):
218224
# Special case for LTXV-13B which doesn't yet have a Diffusers config
219-
if source == LtxvModelVersion.LTXV_13B_097_DEV:
225+
if source in (
226+
LtxvModelVersion.LTXV_13B_097_DEV,
227+
LtxvModelVersion.LTXV_13B_097_DISTILLED,
228+
):
220229
return _load_ltxv_13b_transformer(source.safetensors_url, dtype=dtype)
221230

222231
return LTXVideoTransformer3DModel.from_single_file(

0 commit comments

Comments
 (0)