musictimer commited on
Commit
a836ad8
·
1 Parent(s): 62f4595

Fix initial bugs

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -345,13 +345,11 @@ class WebGameEngine:
345
  '/app' in os.getcwd()
346
  ])
347
 
348
- # Allow forcing compilation on HF Spaces with FORCE_TORCH_COMPILE=1
349
- force_compile = os.getenv("FORCE_TORCH_COMPILE", "0") == "1"
350
  disable_compile = os.getenv("DISABLE_TORCH_COMPILE", "0") == "1"
351
 
352
- compile_enabled = (device.type == "cuda" and
353
- not disable_compile and
354
- (force_compile or not is_hf_spaces))
355
 
356
  if compile_enabled:
357
  logger.info("Compiling models for faster inference (like play.py --compile)...")
@@ -365,11 +363,9 @@ class WebGameEngine:
365
  logger.info("Continuing without model compilation...")
366
  else:
367
  if disable_compile:
368
- reason = "DISABLE_TORCH_COMPILE=1"
369
- elif is_hf_spaces and not force_compile:
370
- reason = "HF Spaces detected (use FORCE_TORCH_COMPILE=1 to override)"
371
  else:
372
- reason = "no CUDA device"
373
  logger.info(f"Model compilation disabled ({reason}). Models will run uncompiled.")
374
 
375
  # Reset environment
 
345
  '/app' in os.getcwd()
346
  ])
347
 
348
+ # Enable compilation by default everywhere, including HF Spaces
349
+ # Can disable with DISABLE_TORCH_COMPILE=1 if needed
350
  disable_compile = os.getenv("DISABLE_TORCH_COMPILE", "0") == "1"
351
 
352
+ compile_enabled = (device.type == "cuda" and not disable_compile)
 
 
353
 
354
  if compile_enabled:
355
  logger.info("Compiling models for faster inference (like play.py --compile)...")
 
363
  logger.info("Continuing without model compilation...")
364
  else:
365
  if disable_compile:
366
+ reason = "DISABLE_TORCH_COMPILE=1 set"
 
 
367
  else:
368
+ reason = "no CUDA device available"
369
  logger.info(f"Model compilation disabled ({reason}). Models will run uncompiled.")
370
 
371
  # Reset environment