Instructions to use hgjc/ltx-ugc-bundle with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LTX.io
How to use hgjc/ltx-ugc-bundle with LTX.io:
# Install the LTX-2 pipelines git clone https://github.com/Lightricks/LTX-2.git cd LTX-2 uv sync --frozen
# Download the weights from this repo, plus the Gemma text encoder hf download hgjc/ltx-ugc-bundle --local-dir models/ltx-ugc-bundle hf download google/gemma-3-12b-it-qat-q4_0-unquantized --local-dir models/gemma-3-12b
# Fast pipeline (distilled model, no distilled LoRA needed) uv run python -m ltx_pipelines.distilled \ --distilled-checkpoint-path models/ltx-ugc-bundle/<distilled-checkpoint>.safetensors \ --spatial-upsampler-path models/ltx-ugc-bundle/<spatial-upsampler>.safetensors \ --gemma-root models/gemma-3-12b \ --prompt "A beautiful sunset over the ocean" \ --output-path output.mp4 # For image-to-video, add: --image path/to/image.jpg 0 0.8# HQ pipeline (two-stage, higher quality) uv run python -m ltx_pipelines.ti2vid_two_stages_hq \ --checkpoint-path models/ltx-ugc-bundle/<checkpoint>.safetensors \ --distilled-lora models/ltx-ugc-bundle/<distilled-lora>.safetensors 0.8 \ --spatial-upsampler-path models/ltx-ugc-bundle/<spatial-upsampler>.safetensors \ --gemma-root models/gemma-3-12b \ --prompt "A beautiful sunset over the ocean" \ --output-path output.mp4 # For image-to-video, add: --image path/to/image.jpg 0 0.8 - Notebooks
- Google Colab
- Kaggle
| import subprocess | |
| import json | |
| import os | |
| import torch | |
| import shutil | |
| import server | |
| import folder_paths | |
| web = server.web | |
| async def test(request): | |
| try: | |
| req_data = await request.json() | |
| output = req_data['output']['gifs'][0] | |
| filename = output['filename'] | |
| typ = output['type'] | |
| base_args = ["ffprobe", "-v", "error", '-count_packets', "-show_entries", "stream", "-of", "json"] | |
| video = folder_paths.get_annotated_filepath(f'{filename} [{typ}]') | |
| vprobe = json.loads(subprocess.run(base_args + ['-select_streams', 'v:0', video], | |
| capture_output=True, check=True).stdout)['streams'][0] | |
| aprobe = json.loads(subprocess.run(base_args + ['-select_streams', 'a:0', video], | |
| capture_output=True, check=True).stdout)['streams'] | |
| probe = {'video': vprobe} | |
| if len(aprobe) > 0: | |
| probe['audio'] = aprobe[0] | |
| errors = [] | |
| compare = None | |
| for test in req_data['tests']: | |
| if test['type'] == 'compare': | |
| compare = test | |
| continue | |
| key = test['key'] | |
| expected = test['value'] | |
| actual = probe[test['type']][key] | |
| if expected != actual: | |
| #Consider always dumping type? | |
| errors.append(f'{key}: {expected} != {actual}') | |
| if len(errors) == 0 and compare is not None: | |
| if not os.path.exists(compare['filename']): | |
| os.makedirs(os.path.split(compare['filename'])[0], exist_ok=True) | |
| shutil.copy(video, compare['filename']) | |
| print("Missing comparison file has been initialized from output:", os.path.abspath(compare['filename'])) | |
| else: | |
| #NOTE: This does not include the full memory optimizations of VHS | |
| #Tests should be small | |
| #TODO: Figure out way to do opacity comparison. May need to do blending in python | |
| #(easy, but slower and more memory intensive) | |
| diff = subprocess.run(['ffmpeg', '-v', 'error', '-i', video, '-i', compare['filename'], '-filter_complex', 'blend=all_mode=grainextract', '-pix_fmt', 'rgb24', '-f', 'rawvideo', '-'], stdout=subprocess.PIPE, check=True).stdout | |
| diff = torch.frombuffer(diff, dtype=torch.uint8).to(dtype=torch.float32).div_(255) | |
| #diff = diff.reshape((-1,4)) | |
| d = (diff-0.5).abs().sum()/diff.size(0) | |
| if d > compare['tolerance']: | |
| errors.append(f'Similarity is outside specified tolerance: {d}') | |
| else: | |
| print('d:', d) | |
| return web.json_response(errors) | |
| except Exception as e: | |
| return web.json_response(str(e)) | |