Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files19 unmodified lines20212223242528 unmodified lines545556575859606162636419 unmodified linesMODEL_ID = "Boogu/Boogu-Image-0.1-Edit"TURBO_ID = "Boogu/Boogu-Image-0.1-Turbo"AOTI_REPO = "multimodalart/Boogu-Image-0.1-Edit-aoti"pipe = BooguImagePipeline.from_pretrained(MODEL_ID,28 unmodified lines_block_dir = Path(snapshot_download(AOTI_REPO)) / "BooguImageTransformerBlock"if (_block_dir / "package.pt2").exists():aoti_load_from_module_dir(pipe.transformer.single_stream_layers, _block_dir)print(f"AoTI: patched {len(pipe.transformer.single_stream_layers)} single-stream blocks")else:print("AoTI: package.pt2 not found, running eager")except Exception as exc: # noqa: BLE001print(f"AoTI load failed ({exc!r}); running eager")MAX_SEED = 2**31 - 119 unmodified lines2021222324252627282928 unmodified lines58596061626364656667686970717273747576777879808182838419 unmodified linesMODEL_ID = "Boogu/Boogu-Image-0.1-Edit"TURBO_ID = "Boogu/Boogu-Image-0.1-Turbo"AOTI_REPO = "multimodalart/Boogu-Image-0.1-Edit-aoti"# Set to a Turbo AoTI repo to patch the Turbo single-stream blocks (None = eager).# Flip between "...-Turbo-aoti" (default compile) and "...-Turbo-aoti-mat" (max_autotune)# to A/B the compiled variants. Leave None to keep the eager 3.3s baseline.TURBO_AOTI_REPO = os.environ.get("TURBO_AOTI_REPO") or Nonepipe = BooguImagePipeline.from_pretrained(MODEL_ID,28 unmodified lines_block_dir = Path(snapshot_download(AOTI_REPO)) / "BooguImageTransformerBlock"if (_block_dir / "package.pt2").exists():aoti_load_from_module_dir(pipe.transformer.single_stream_layers, _block_dir)print(f"AoTI: patched {len(pipe.transformer.single_stream_layers)} Edit single-stream blocks")else:print("AoTI: Edit package.pt2 not found, running eager")except Exception as exc: # noqa: BLE001print(f"AoTI (Edit) load failed ({exc!r}); running eager")# Optionally patch the Turbo single-stream blocks too (off by default = eager baseline).if TURBO_AOTI_REPO:try:from pathlib import Pathfrom huggingface_hub import snapshot_downloadfrom spaces.zero.torch.aoti import aoti_load_from_module_dir_t_dir = Path(snapshot_download(TURBO_AOTI_REPO)) / "BooguImageTransformerBlock"if (_t_dir / "package.pt2").exists():aoti_load_from_module_dir(turbo_pipe.transformer.single_stream_layers, _t_dir)print(f"AoTI: patched {len(turbo_pipe.transformer.single_stream_layers)} Turbo blocks from {TURBO_AOTI_REPO}")else:print(f"AoTI: Turbo package.pt2 not found in {TURBO_AOTI_REPO}, running eager")except Exception as exc: # noqa: BLE001print(f"AoTI (Turbo) load failed ({exc!r}); running eager")MAX_SEED = 2**31 - 1
app.py+23-3