Spaces:
Paused
Paused
Update app.py
Browse files278 unmodified lines27928028128228328428589 unmodified lines375376377378379380381382383384385386387388389390391392393394395396397398399400401402403278 unmodified linesPENDING_LORA_STATE: dict[str, torch.Tensor] | None = NonePENDING_LORA_STATUS: str = "No LoRA state prepared yet."checkpoint_path = hf_hub_download(repo_id=LTX_MODEL_REPO, filename="ltx-2.3-22b-distilled.safetensors")spatial_upsampler_path = hf_hub_download(repo_id=LTX_MODEL_REPO, filename="ltx-2.3-spatial-upscaler-x2-1.0.safetensors")gemma_root = snapshot_download(repo_id=GEMMA_REPO)89 unmodified linesnew_transformer_cpu = Nonetry:progress(0.35, desc="Building fused CPU transformer")tmp_ledger = ledger.with_loras(tuple(loras_for_builder))orig_tmp_target = getattr(tmp_ledger, "_target_device", None)orig_tmp_device = getattr(tmp_ledger, "device", None)try:tmp_ledger._target_device = lambda: torch.device("cpu")tmp_ledger.device = torch.device("cpu")new_transformer_cpu = tmp_ledger.transformer()finally:if orig_tmp_target is not None:tmp_ledger._target_device = orig_tmp_targetelse:try:delattr(tmp_ledger, "_target_device")except Exception:passif orig_tmp_device is not None:tmp_ledger.device = orig_tmp_deviceelse:try:delattr(tmp_ledger, "device")except Exception:passprogress(0.70, desc="Extracting fused state_dict")state = new_transformer_cpu.state_dict()278 unmodified lines27928028128228328428528628728828929029129289 unmodified lines382383384385386387388389390391392393394395396397278 unmodified linesPENDING_LORA_STATE: dict[str, torch.Tensor] | None = NonePENDING_LORA_STATUS: str = "No LoRA state prepared yet."weights_dir = Path("weights")weights_dir.mkdir(exist_ok=True)checkpoint_path = hf_hub_download(repo_id=LTX_MODEL_REPO,filename="ltx-2.3-22b-distilled.safetensors",local_dir=str(weights_dir),local_dir_use_symlinks=False,)spatial_upsampler_path = hf_hub_download(repo_id=LTX_MODEL_REPO, filename="ltx-2.3-spatial-upscaler-x2-1.0.safetensors")gemma_root = snapshot_download(repo_id=GEMMA_REPO)89 unmodified linesnew_transformer_cpu = Nonetry:progress(0.35, desc="Building fused CPU transformer")tmp_ledger = pipeline.model_ledger.__class__(dtype=ledger.dtype,device=torch.device("cpu"),checkpoint_path=str(checkpoint_path),spatial_upsampler_path=str(spatial_upsampler_path),gemma_root_path=str(gemma_root),loras=tuple(loras_for_builder),quantization=getattr(ledger, "quantization", None),)new_transformer_cpu = tmp_ledger.transformer()progress(0.70, desc="Extracting fused state_dict")state = new_transformer_cpu.state_dict()
app.py+18-24