Spaces:
Paused
Paused
Update app.py
Browse files506 unmodified lines507508509510510511512513513514515516517518519520521522517518519520521522523524525524525526527527528529529530531532533506 unmodified lines except Exception as e: print(f"[LoRA] pipeline rebuild FAILED: {e}")
# Force transformer rebuild so LoRA strength actually applies # Reset transformer so next call rebuilds it with new LoRA strength (NO preloading!) try: if hasattr(pipeline, "model_ledger"): # Hard reset ALL known transformer references if hasattr(pipeline.model_ledger, "_transformer"): del pipeline.model_ledger._transformer pipeline.model_ledger._transformer = None # VERY IMPORTANT: also clear pipeline components cache if present if hasattr(pipeline, "pipeline_components"): try: pipeline.pipeline_components = None except Exception: pass if hasattr(pipeline, "pipeline_components"): try: del pipeline.pipeline_components pipeline.pipeline_components = None except Exception: pass # Force rebuild NOW (so it uses the new LoRA strength) _ = pipeline.model_ledger.transformer() # CRITICAL: force cleanup BEFORE rebuild happens cleanup_memory() torch.cuda.empty_cache() print("[LoRA] transformer force-rebuilt with new strength") print("[LoRA] transformer reset; will rebuild during inference") except Exception as e: print(f"[LoRA] transformer rebuild failed: {e}") print(f"[LoRA] transformer reset failed: {e}") log_memory("before pipeline call")
app.py+13-12