| ```CODE: |
| import torch |
| from diffusers import DiffusionPipeline |
| from diffusers.utils import load_image, export_to_video |
|
|
| # switch to "mps" for apple devices |
| pipe = DiffusionPipeline.from_pretrained("Lightricks/LTX-2", dtype=torch.bfloat16, device_map="cuda") |
| pipe.to("cuda") |
|
|
| prompt = "A man with short gray hair plays a red electric guitar." |
| image = load_image( |
| "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" |
| ) |
|
|
| output = pipe(image=image, prompt=prompt).frames[0] |
| export_to_video(output, "output.mp4") |
| ``` |
|
|
| ERROR: |
| Traceback (most recent call last): |
| File "/tmp/Lightricks_LTX-2_0JZHfcU.py", line 28, in <module> |
| pipe = DiffusionPipeline.from_pretrained("Lightricks/LTX-2", dtype=torch.bfloat16, device_map="cuda") |
| File "/tmp/.cache/uv/environments-v2/e8822e4ae31fc8f1/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn |
| return fn(*args, **kwargs) |
| File "/tmp/.cache/uv/environments-v2/e8822e4ae31fc8f1/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 829, in from_pretrained |
| cached_folder = cls.download( |
| pretrained_model_name_or_path, |
| ...<14 lines>... |
| **kwargs, |
| ) |
| File "/tmp/.cache/uv/environments-v2/e8822e4ae31fc8f1/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn |
| return fn(*args, **kwargs) |
| File "/tmp/.cache/uv/environments-v2/e8822e4ae31fc8f1/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 1637, in download |
| custom_components, folder_names = _get_custom_components_and_folders( |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ |
| pretrained_model_name, config_dict, filenames, variant |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ) |
| ^ |
| File "/tmp/.cache/uv/environments-v2/e8822e4ae31fc8f1/lib/python3.13/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 1071, in _get_custom_components_and_folders |
| raise ValueError( |
| f"{candidate_file} as defined in `model_index.json` does not exist in {pretrained_model_name} and is not a module in 'diffusers/pipelines'." |
| ) |
| ValueError: connectors/ltx2.py as defined in `model_index.json` does not exist in Lightricks/LTX-2 and is not a module in 'diffusers/pipelines'. |
|
|