Oysiyl commited on
Commit
134881e
·
1 Parent(s): 32d227e

Fix AOT compilation: move call after pipeline function definitions

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -509,13 +509,6 @@ def compile_models_with_aoti():
509
  return False
510
 
511
 
512
- # Call AOT compilation during startup (only on CUDA, not MPS)
513
- if not torch.backends.mps.is_available():
514
- compile_models_with_aoti()
515
- else:
516
- print("ℹ️ AOT compilation skipped on MPS (MacBook) - using eager mode\n")
517
-
518
-
519
  @spaces.GPU(duration=60) # Reduced from 720s - AOTI compilation speeds up inference
520
  def generate_qr_code_unified(
521
  prompt: str,
@@ -1689,6 +1682,13 @@ def _pipeline_artistic(
1689
  log_progress(msg, gr_progress, 1.0)
1690
  yield (final_image, msg)
1691
 
 
 
 
 
 
 
 
1692
 
1693
  if __name__ == "__main__" and not os.environ.get("QR_TESTING_MODE"):
1694
  # Start your Gradio app with automatic cache cleanup
 
509
  return False
510
 
511
 
 
 
 
 
 
 
 
512
  @spaces.GPU(duration=60) # Reduced from 720s - AOTI compilation speeds up inference
513
  def generate_qr_code_unified(
514
  prompt: str,
 
1682
  log_progress(msg, gr_progress, 1.0)
1683
  yield (final_image, msg)
1684
 
1685
+ # Call AOT compilation during startup (only on CUDA, not MPS)
1686
+ # This must be after pipeline function definitions
1687
+ if not torch.backends.mps.is_available():
1688
+ compile_models_with_aoti()
1689
+ else:
1690
+ print("ℹ️ AOT compilation skipped on MPS (MacBook) - using eager mode\n")
1691
+
1692
 
1693
  if __name__ == "__main__" and not os.environ.get("QR_TESTING_MODE"):
1694
  # Start your Gradio app with automatic cache cleanup