Instructions to use modest-mouse/ltx-ugc-bundle with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LTX-2
How to use modest-mouse/ltx-ugc-bundle with LTX-2:
# 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 modest-mouse/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
File size: 2,800 Bytes
0c222d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import { getResolver } from "./shared_utils.js";
import { getPngMetadata, getWebpMetadata } from "./comfyui_shim.js";
function parseWorkflowJson(stringJson) {
stringJson = stringJson || "null";
stringJson = stringJson.replace(/:\s*NaN/g, ": null");
return JSON.parse(stringJson);
}
export async function tryToGetWorkflowDataFromEvent(e) {
var _a, _b, _c, _d;
let work;
for (const file of ((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) || []) {
const data = await tryToGetWorkflowDataFromFile(file);
if (data.workflow || data.prompt) {
return data;
}
}
const validTypes = ["text/uri-list", "text/x-moz-url"];
const match = (((_b = e.dataTransfer) === null || _b === void 0 ? void 0 : _b.types) || []).find((t) => validTypes.find((v) => t === v));
if (match) {
const uri = (_d = (_c = e.dataTransfer.getData(match)) === null || _c === void 0 ? void 0 : _c.split("\n")) === null || _d === void 0 ? void 0 : _d[0];
if (uri) {
return tryToGetWorkflowDataFromFile(await (await fetch(uri)).blob());
}
}
return { workflow: null, prompt: null };
}
export async function tryToGetWorkflowDataFromFile(file) {
var _a;
if (file.type === "image/png") {
const pngInfo = await getPngMetadata(file);
return {
workflow: parseWorkflowJson(pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.workflow),
prompt: parseWorkflowJson(pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.prompt),
};
}
if (file.type === "image/webp") {
const pngInfo = await getWebpMetadata(file);
const workflow = parseWorkflowJson((pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.workflow) || (pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.Workflow) || "null");
const prompt = parseWorkflowJson((pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.prompt) || (pngInfo === null || pngInfo === void 0 ? void 0 : pngInfo.Prompt) || "null");
return { workflow, prompt };
}
if (file.type === "application/json" || ((_a = file.name) === null || _a === void 0 ? void 0 : _a.endsWith(".json"))) {
const resolver = getResolver();
const reader = new FileReader();
reader.onload = async () => {
const json = parseWorkflowJson(reader.result);
const isApiJson = Object.values(json).every((v) => v.class_type);
const prompt = isApiJson ? json : null;
const workflow = !isApiJson && !(json === null || json === void 0 ? void 0 : json.templates) ? json : null;
return { workflow, prompt };
};
return resolver.promise;
}
return { workflow: null, prompt: null };
}
|