Spaces:
Runtime error
Runtime error
Commit ·
7359eb6
1
Parent(s): 5fcc5dc
diffusers 0.40: load LTX2 GGUF via LTX2VideoTransformer3DModel.from_single_file
Browse files- app.py +10 -5
- requirements.txt +4 -3
app.py
CHANGED
|
@@ -80,12 +80,17 @@ def _download_gguf(dest: str) -> str:
|
|
| 80 |
|
| 81 |
|
| 82 |
def _build_transformer(gguf_path: str):
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
try:
|
| 86 |
-
#
|
| 87 |
from diffusers.quantizers.quantization_config import GGUFQuantizationConfig
|
| 88 |
-
except ImportError: #
|
| 89 |
from diffusers.utils import GGUFQuantizationConfig
|
| 90 |
|
| 91 |
kwargs = dict(
|
|
@@ -93,10 +98,10 @@ def _build_transformer(gguf_path: str):
|
|
| 93 |
dtype=torch.bfloat16,
|
| 94 |
)
|
| 95 |
try:
|
| 96 |
-
return
|
| 97 |
except Exception as exc: # config may live elsewhere; trust the GGUF KV metadata
|
| 98 |
print(f"[ltx] from_single_file with config failed ({exc}), retrying without")
|
| 99 |
-
return
|
| 100 |
|
| 101 |
|
| 102 |
def _load_model() -> dict:
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
def _build_transformer(gguf_path: str):
|
| 83 |
+
try:
|
| 84 |
+
# diffusers 0.40 (pinned): the LTX-2 video transformer is loadable from
|
| 85 |
+
# a single GGUF file via FromOriginalModelMixin.
|
| 86 |
+
from diffusers import LTX2VideoTransformer3DModel as TransformerCls
|
| 87 |
+
except ImportError: # older versions only expose the generic AutoModel
|
| 88 |
+
from diffusers import AutoModel as TransformerCls
|
| 89 |
|
| 90 |
try:
|
| 91 |
+
# GGUF config lives in quantizers since 0.33; newer releases keep it there.
|
| 92 |
from diffusers.quantizers.quantization_config import GGUFQuantizationConfig
|
| 93 |
+
except ImportError: # legacy export path
|
| 94 |
from diffusers.utils import GGUFQuantizationConfig
|
| 95 |
|
| 96 |
kwargs = dict(
|
|
|
|
| 98 |
dtype=torch.bfloat16,
|
| 99 |
)
|
| 100 |
try:
|
| 101 |
+
return TransformerCls.from_single_file(gguf_path, config=PIPELINE_ID, **kwargs)
|
| 102 |
except Exception as exc: # config may live elsewhere; trust the GGUF KV metadata
|
| 103 |
print(f"[ltx] from_single_file with config failed ({exc}), retrying without")
|
| 104 |
+
return TransformerCls.from_single_file(gguf_path, **kwargs)
|
| 105 |
|
| 106 |
|
| 107 |
def _load_model() -> dict:
|
requirements.txt
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
# For ZeroGPU, gradio/spaces/huggingface_hub/torch are preinstalled and
|
| 2 |
# platform-managed; the Dockerfile installs them explicitly.
|
| 3 |
-
# Pinned to 0.
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
| 6 |
transformers==4.49.0
|
| 7 |
accelerate>=1.0
|
| 8 |
gguf
|
|
|
|
| 1 |
# For ZeroGPU, gradio/spaces/huggingface_hub/torch are preinstalled and
|
| 2 |
# platform-managed; the Dockerfile installs them explicitly.
|
| 3 |
+
# Pinned to 0.40: LTX2 video transformer + GGUF single-file loading both work
|
| 4 |
+
# here (LTX2VideoTransformer3DModel + GGUFQuantizer). Earlier versions lack
|
| 5 |
+
# AutoModel/from_single_file support for LTX-2 GGUF.
|
| 6 |
+
diffusers==0.40.0
|
| 7 |
transformers==4.49.0
|
| 8 |
accelerate>=1.0
|
| 9 |
gguf
|