diffusers
diffusers copied to clipboard
Error in init from pretrained for LTXConditionPipeline
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.
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
@a-r-r-o-w could you take a look here please
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?
Same error for me with the Python 3.11 and 3.13 with latest version libraries and CUDA on windows and on linux...
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
</details>
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
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.
Looks like the problem get solved by installing sentencepiece package.
pip install sentencepiece
And diffusers don't need to be installed from git ;)
Closing this since it appears to be an env issue.