TwoQuarks commited on
Commit
49f3e0e
·
verified ·
1 Parent(s): cc4fd03

Update Down/run_all.py

Browse files
Files changed (1) hide show
  1. Down/run_all.py +11 -1
Down/run_all.py CHANGED
@@ -11,6 +11,10 @@ This will:
11
 
12
  from __future__ import annotations
13
 
 
 
 
 
14
  import argparse
15
  import os
16
  import subprocess
@@ -36,25 +40,31 @@ def main() -> None:
36
  graphics_dir = root / "graphics"
37
  results_dir.mkdir(parents=True, exist_ok=True)
38
  graphics_dir.mkdir(parents=True, exist_ok=True)
 
 
39
  common_env = {
40
  "TWOQUARKS_RESULTS_DIR": results_dir.as_posix(),
41
  "TWOQUARKS_GRAPHICS_DIR": graphics_dir.as_posix(),
 
42
  }
 
43
  down_dir = root / "down"
44
  AntiDown_dir = root / "AntiDown"
45
 
46
  # DOWN
47
  down_script = down_dir / "exp" / "run_paradox_tabular.py"
48
  _run([sys.executable, str(down_script)], cwd=down_dir, env=common_env)
 
49
  plot_script = down_dir / "exp" / "plot_paradox_results.py"
50
  _run([sys.executable, str(plot_script)], cwd=down_dir, env=common_env)
 
51
  # AntiDown
52
  AntiDown_script = AntiDown_dir / "exp" / "run_corrupted_valley_tabular.py"
53
  _run([sys.executable, str(AntiDown_script)], cwd=AntiDown_dir, env=common_env)
 
54
  AntiDown_plot = AntiDown_dir / "exp" / "plot_corrupted_valley_results.py"
55
  _run([sys.executable, str(AntiDown_plot)], cwd=AntiDown_dir, env=common_env)
56
 
57
-
58
  # Dual overlay plot (Down vs AntiDown)
59
  dual_plot = root / "plot_dual_down_antidown.py"
60
  if dual_plot.exists():
 
11
 
12
  from __future__ import annotations
13
 
14
+ # Headless-safe plotting (Hugging Face / Linux without DISPLAY)
15
+ import matplotlib
16
+ matplotlib.use("Agg")
17
+
18
  import argparse
19
  import os
20
  import subprocess
 
40
  graphics_dir = root / "graphics"
41
  results_dir.mkdir(parents=True, exist_ok=True)
42
  graphics_dir.mkdir(parents=True, exist_ok=True)
43
+
44
+ # Common env for all subprocesses (plots must be headless-safe)
45
  common_env = {
46
  "TWOQUARKS_RESULTS_DIR": results_dir.as_posix(),
47
  "TWOQUARKS_GRAPHICS_DIR": graphics_dir.as_posix(),
48
+ "MPLBACKEND": "Agg", # <-- critical for HF headless plotting
49
  }
50
+
51
  down_dir = root / "down"
52
  AntiDown_dir = root / "AntiDown"
53
 
54
  # DOWN
55
  down_script = down_dir / "exp" / "run_paradox_tabular.py"
56
  _run([sys.executable, str(down_script)], cwd=down_dir, env=common_env)
57
+
58
  plot_script = down_dir / "exp" / "plot_paradox_results.py"
59
  _run([sys.executable, str(plot_script)], cwd=down_dir, env=common_env)
60
+
61
  # AntiDown
62
  AntiDown_script = AntiDown_dir / "exp" / "run_corrupted_valley_tabular.py"
63
  _run([sys.executable, str(AntiDown_script)], cwd=AntiDown_dir, env=common_env)
64
+
65
  AntiDown_plot = AntiDown_dir / "exp" / "plot_corrupted_valley_results.py"
66
  _run([sys.executable, str(AntiDown_plot)], cwd=AntiDown_dir, env=common_env)
67
 
 
68
  # Dual overlay plot (Down vs AntiDown)
69
  dual_plot = root / "plot_dual_down_antidown.py"
70
  if dual_plot.exists():