diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Error in init from pretrained for LTXConditionPipeline

Open Vickeyhw opened this issue 6 months ago • 2 comments

Describe the bug

pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", torch_dtype=torch.bfloat16)

File "/opt/nas/p/conda/envs/diffuser0526/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/opt/nas/p/conda/envs/diffuser0526/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 986, in from_pretrained loaded_sub_model = load_sub_model( File "/opt/nas/p/conda/envs/diffuser0526/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 711, in load_sub_model raise ValueError( ValueError: The component <class 'transformers.models.t5.tokenization_t5._LazyModule.getattr..Placeholder'> of <class 'diffusers.pipelines.ltx.pipeline_ltx_condition.LTXConditionPipeline'> cannot be loaded as it does not seem to have any of the loading methods defined in {'ModelMixin': ['save_pretrained', 'from_pretrained'], 'SchedulerMixin': ['save_pretrained', 'from_pretrained'], 'DiffusionPipeline': ['save_pretrained', 'from_pretrained'], 'OnnxRuntimeModel': ['save_pretrained', 'from_pretrained'], 'PreTrainedTokenizer': ['save_pretrained', 'from_pretrained'], 'PreTrainedTokenizerFast': ['save_pretrained', 'from_pretrained'], 'PreTrainedModel': ['save_pretrained', 'from_pretrained'], 'FeatureExtractionMixin': ['save_pretrained', 'from_pretrained'], 'ProcessorMixin': ['save_pretrained', 'from_pretrained'], 'ImageProcessingMixin': ['save_pretrained', 'from_pretrained'], 'ORTModule': ['save_pretrained', 'from_pretrained']}.

Reproduction

from transformers import CLIPVisionModel from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", torch_dtype=torch.bfloat16)

Logs


System Info

  • 🤗 Diffusers version: 0.34.0.dev0
  • Platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.35
  • Running on Google Colab?: No
  • Python version: 3.10.16
  • PyTorch version (GPU?): 2.7.0+cu126 (True)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Huggingface_hub version: 0.32.0
  • Transformers version: 4.52.3
  • Accelerate version: 1.7.0
  • PEFT version: 0.15.2
  • Bitsandbytes version: not installed
  • Safetensors version: 0.5.3
  • xFormers version: not installed
  • Accelerator: NVIDIA A800-SXM4-40GB, 40960 MiB

Who can help?

@yiyixuxu @DN6

Vickeyhw avatar Jun 02 '25 08:06 Vickeyhw

@a-r-r-o-w could you take a look here please

DN6 avatar Jun 10 '25 17:06 DN6

I replicated the package versions mentioned in the system info and tried to run the example code. Cannot seem to reproduce the error here though.

@Vickeyhw This could most likely be a faulty environment or download of the models/configs. Could you try to delete any existing model files that have been cached, and restart the process?

a-r-r-o-w avatar Jun 10 '25 20:06 a-r-r-o-w

Same error for me with the Python 3.11 and 3.13 with latest version libraries and CUDA on windows and on linux...

LukeMech avatar Jul 06 '25 18:07 LukeMech

Working for me

import torch
from transformers import CLIPVisionModel
from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", torch_dtype=torch.bfloat16)

(sddw-dev) C:\aiOWN\diffuser_webui>python Test.py
W0707 14:20:40.073000 9512 site-packages\torch\distributed\elastic\multiprocessing\redirects.py:29] NOTE: Redirects are currently not supported in Windows or MacOs.
model_index.json: 100%|███████████████████████████████████████████| 421/421 [00:00<00:00, 239kB/s]
scheduler_config.json: 100%|█████████████████████████████████████████████| 487/487 [00:00<?, ?B/s]
model.safetensors.index.json: 19.9kB [00:00, ?B/s]                 | 2/22 [00:03<00:37,  1.88s/it]
added_tokens.json: 2.59kB [00:00, ?B/s]:00, ?B/s]
config.json: 100%|███████████████████████████████████████████████████████| 781/781 [00:00<?, ?B/s]

Try this

pip uninstall diffusers -y

pip install git+https://github.com/huggingface/diffusers.git

Pip list

``` (sddw-dev) C:\aiOWN\diffuser_webui>pip list Package Version ----------------------- -------------------------- absl-py 2.3.0 accelerate 1.8.0.dev0 addict 2.4.0 aiofiles 24.1.0 albucore 0.0.24 albumentations 2.0.8 aliyun-python-sdk-core 2.16.0 aliyun-python-sdk-kms 2.16.5 annotated-types 0.7.0 antlr4-python3-runtime 4.9.3 anyio 4.9.0 asttokens 3.0.0 attrs 25.3.0 basicsr 1.4.2 bitsandbytes 0.46.0 certifi 2025.6.15 cffi 1.17.1 charset-normalizer 3.4.2 chumpy 0.70 click 8.2.1 colorama 0.4.6 coloredlogs 15.0.1 comm 0.2.2 contourpy 1.3.2 controlnet_aux 0.0.10 crcmod 1.7 cryptography 45.0.4 cupy-cuda12x 13.4.1 cycler 0.12.1 Cython 3.1.2 debugpy 1.8.14 decorator 5.2.1 diffusers 0.35.0.dev0 easy_dwpose 1.0.2 easydict 1.13 einops 0.8.1 executing 2.2.0 facexlib 0.3.0 fastapi 0.115.13 fastrlock 0.8.3 ffmpy 0.6.0 filelock 3.14.0 filterpy 1.4.5 flatbuffers 25.2.10 fonttools 4.58.4 fsspec 2025.5.1 ftfy 6.3.1 future 1.0.0 gfpgan 1.3.8 gguf 0.17.0 gradio 5.34.0 gradio_client 1.10.3 groovy 0.1.2 grpcio 1.73.0 h11 0.16.0 hf-xet 1.1.4 httpcore 1.0.9 httpx 0.28.1 huggingface-hub 0.33.0 humanfriendly 10.0 idna 3.10 image_gen_aux 0.1.0.dev0 imageio 2.37.0 imageio-ffmpeg 0.6.0 importlib_metadata 8.7.0 insightface 0.7.3 ipykernel 6.29.5 ipython 9.3.0 ipython_pygments_lexers 1.1.1 ipywidgets 8.1.7 jax 0.6.1 jaxlib 0.6.1 jedi 0.19.2 Jinja2 3.1.6 jmespath 0.10.0 joblib 1.5.1 json-tricks 3.17.3 jupyter_client 8.6.3 jupyter_core 5.8.1 jupyterlab_widgets 3.0.15 kiwisolver 1.4.8 kornia 0.8.1 kornia_rs 0.1.9 lark 1.2.2 lazy_loader 0.4 llvmlite 0.44.0 lmdb 1.6.2 loguru 0.7.3 Markdown 3.8 markdown-it-py 3.0.0 MarkupSafe 3.0.2 matplotlib 3.10.3 matplotlib-inline 0.1.7 mdurl 0.1.2 mediapipe 0.10.21 ml_dtypes 0.5.1 mmcv 2.1.0 mmdet 3.2.0 mmengine 0.10.7 mmpose 1.3.2 model-index 0.1.11 modelscope 1.27.1 mpmath 1.3.0 munkres 1.1.4 nest-asyncio 1.6.0 networkx 3.5 ninja 1.11.1.4 numba 0.61.2 numpy 1.26.4 nunchaku 0.3.2.dev20250701+torch2.7 omegaconf 2.3.0 onnx 1.18.0 onnxruntime-gpu 1.22.0 opencv-contrib-python 4.11.0.86 opencv-python 4.11.0.86 opencv-python-headless 4.11.0.86 opendatalab 0.0.10 openmim 0.3.9 openxlab 0.1.2 opt_einsum 3.4.0 optimum-quanto 0.2.7.dev0 ordered-set 4.1.0 orjson 3.10.18 oss2 2.17.0 packaging 24.2 pandas 2.3.0 parso 0.8.4 patch-conv 0.0.1b0 peft 0.15.2.dev0 piexif 1.1.3 pillow 11.2.1 pip 25.1 platformdirs 4.3.8 prettytable 3.16.0 prompt_toolkit 3.0.51 protobuf 4.25.8 psutil 7.0.0 pure_eval 0.2.3 pycocotools 2.0.10 pycparser 2.22 pycryptodome 3.23.0 pydantic 2.11.7 pydantic_core 2.33.2 pydub 0.25.1 Pygments 2.19.1 pyparsing 3.2.3 pyreadline3 3.5.4 python-dateutil 2.9.0.post0 python-multipart 0.0.20 pytz 2023.4 pywin32 310 PyYAML 6.0.2 pyzmq 27.0.0 realesrgan 0.3.0 regex 2024.11.6 requests 2.28.2 rich 13.4.2 ruff 0.11.13 safehttpx 0.1.6 safetensors 0.5.3 scikit-image 0.25.2 scikit-learn 1.7.0 scipy 1.15.3 sd_embed 1.240829.1 semantic-version 2.10.0 sentencepiece 0.2.0 setuptools 60.2.0 shapely 2.1.1 shellingham 1.5.4 simsimd 6.4.9 six 1.17.0 sniffio 1.3.1 sounddevice 0.5.2 spandrel 0.4.1 stack-data 0.6.3 starlette 0.46.2 stringzilla 3.12.5 sympy 1.14.0 tabulate 0.9.0 tb-nightly 2.20.0a20250617 tensorboard-data-server 0.7.2 termcolor 3.1.0 terminaltables 3.1.10 threadpoolctl 3.6.0 tifffile 2025.6.11 timm 1.0.15 tokenizers 0.21.1 tomlkit 0.13.3 torch 2.7.0+cu126 torchao 0.11.0 torchaudio 2.7.0+cu126 torchvision 0.22.0+cu126 tornado 6.5.1 tqdm 4.67.1 traitlets 5.14.3 transformers 4.52.4 triton-windows 3.3.1.post19 typer 0.16.0 typing_extensions 4.14.0 typing-inspection 0.4.1 tzdata 2025.2 urllib3 1.26.20 uvicorn 0.34.3 wcwidth 0.2.13 websockets 15.0.1 Werkzeug 3.1.3 wheel 0.45.1 widgetsnbextension 4.0.14 win32_setctime 1.2.0 xformers 0.0.30 xtcocotools 1.14.3 yapf 0.43.0 zipp 3.23.0
</details>

nitinmukesh avatar Jul 07 '25 08:07 nitinmukesh

This time with python 3.12:

test.py

import torch
from transformers import CLIPVisionModel
from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", torch_dtype=torch.bfloat16)

Result after download completed and I re-run (it was also visible on 1st run)

PS C:\Users\VM\ai> python .\test.py
Loading pipeline components...:  20%|██████████▍                                         | 1/5 [00:01<00:06,  1.70s/it]
Traceback (most recent call last):
  File "C:\Users\VM\ai\test.py", line 4, in <module>
    pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", torch_dtype=torch.bfloat16)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\VM\AppData\Local\Python\pythoncore-3.12-64\Lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\VM\AppData\Local\Python\pythoncore-3.12-64\Lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1022, in from_pretrained
    loaded_sub_model = load_sub_model(
                       ^^^^^^^^^^^^^^^
  File "C:\Users\VM\AppData\Local\Python\pythoncore-3.12-64\Lib\site-packages\diffusers\pipelines\pipeline_loading_utils.py", line 751, in load_sub_model
    raise ValueError(
ValueError: The component <class 'transformers.models.t5.tokenization_t5._LazyModule.__getattr__.<locals>.Placeholder'> of <class 'diffusers.pipelines.ltx.pipeline_ltx_condition.LTXConditionPipeline'> cannot be loaded as it does not seem to have any of the loading methods defined in {'ModelMixin': ['save_pretrained', 'from_pretrained'], 'SchedulerMixin': ['save_pretrained', 'from_pretrained'], 'DiffusionPipeline': ['save_pretrained', 'from_pretrained'], 'OnnxRuntimeModel': ['save_pretrained', 'from_pretrained'], 'PreTrainedTokenizer': ['save_pretrained', 'from_pretrained'], 'PreTrainedTokenizerFast': ['save_pretrained', 'from_pretrained'], 'PreTrainedModel': ['save_pretrained', 'from_pretrained'], 'FeatureExtractionMixin': ['save_pretrained', 'from_pretrained'], 'ProcessorMixin': ['save_pretrained', 'from_pretrained'], 'ImageProcessingMixin': ['save_pretrained', 'from_pretrained'], 'ORTModule': ['save_pretrained', 'from_pretrained']}.

Packages

PS C:\Users\VM\ai> python -m pip list
Package            Version
------------------ ------------
accelerate         1.8.1
certifi            2025.6.15
charset-normalizer 3.4.2
colorama           0.4.6
diffusers          0.35.0.dev0
filelock           3.13.1
fsspec             2024.6.1
huggingface-hub    0.33.2
idna               3.10
importlib_metadata 8.7.0
Jinja2             3.1.4
MarkupSafe         2.1.5
mpmath             1.3.0
networkx           3.3
numpy              2.1.2
packaging          25.0
pillow             11.0.0
pip                25.1.1
psutil             7.0.0
PyYAML             6.0.2
regex              2024.11.6
requests           2.32.4
safetensors        0.5.3
setuptools         70.2.0
sympy              1.13.3
tokenizers         0.21.2
torch              2.7.1+cu126
torchaudio         2.7.1+cu126
torchvision        0.22.1+cu126
tqdm               4.67.1
transformers       4.53.1
typing_extensions  4.12.2
urllib3            2.5.0
zipp               3.23.0

LukeMech avatar Jul 07 '25 12:07 LukeMech

@LukeMech

Can you try creating virtual environment using this and check. Python version doesn't matter. https://github.com/newgenai79/sd-diffuser-webui/blob/main/requirements.txt

Let's try to get the bottom of the issue which package is creating problem.

nitinmukesh avatar Jul 07 '25 12:07 nitinmukesh

Looks like the problem get solved by installing sentencepiece package.

pip install sentencepiece

And diffusers don't need to be installed from git ;)

LukeMech avatar Jul 08 '25 06:07 LukeMech

Closing this since it appears to be an env issue.

DN6 avatar Jul 09 '25 05:07 DN6