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