Team Ai
Datasetpublic

model-metadata/code_execution_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes25kdownloads
Lightricks_LTX-Video_0.txt51 linesDownload Raw Back to root
1```CODE: 2import torch3from diffusers import DiffusionPipeline4from diffusers.utils import load_image, export_to_video5 6# switch to "mps" for apple devices7pipe = DiffusionPipeline.from_pretrained("Lightricks/LTX-Video", dtype=torch.bfloat16, device_map="cuda")8pipe.to("cuda")9 10prompt = "A man with short gray hair plays a red electric guitar."11image = load_image(12    "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png"13)14 15output = pipe(image=image, prompt=prompt).frames[0]16export_to_video(output, "output.mp4")17```18 19ERROR: 20Traceback (most recent call last):21  File "/tmp/Lightricks_LTX-Video_0PrdE45.py", line 28, in <module>22    pipe = DiffusionPipeline.from_pretrained("Lightricks/LTX-Video", dtype=torch.bfloat16, device_map="cuda")23  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn24    return fn(*args, **kwargs)25  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 1025, in from_pretrained26    loaded_sub_model = load_sub_model(27        library_name=library_name,28    ...<21 lines>...29        quantization_config=quantization_config,30    )31  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 860, in load_sub_model32    loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)33  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn34    return fn(*args, **kwargs)35  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/diffusers/models/modeling_utils.py", line 1288, in from_pretrained36    ) = cls._load_pretrained_model(37        ~~~~~~~~~~~~~~~~~~~~~~~~~~^38        model,39        ^^^^^^40    ...<13 lines>...41        is_parallel_loading_enabled=is_parallel_loading_enabled,42        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^43    )44    ^45  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/diffusers/models/modeling_utils.py", line 1537, in _load_pretrained_model46    _caching_allocator_warmup(model, expanded_device_map, dtype, hf_quantizer)47    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^48  File "/tmp/.cache/uv/environments-v2/cb88948adb0dfc46/lib/python3.13/site-packages/diffusers/models/model_loading_utils.py", line 754, in _caching_allocator_warmup49    _ = torch.empty(warmup_elems, dtype=dtype, device=device, requires_grad=False)50torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 3.58 GiB. GPU 0 has a total capacity of 22.03 GiB of which 2.49 GiB is free. Including non-PyTorch memory, this process has 19.53 GiB memory in use. Of the allocated memory 19.33 GiB is allocated by PyTorch, and 27.19 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)51