File size: 1,170 Bytes
3fbcbf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
"""Launch Modal pipeline — writes output to file, avoids Windows console encoding issues."""
import subprocess, sys, os, io

os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# Force UTF-8 encoding for the Modal CLI subprocess
env = os.environ.copy()
env["PYTHONIOENCODING"] = "utf-8"
env["PYTHONUTF8"] = "1"

print("Launching DiffusionGemma Humanizer on Modal (A100 80GB)...", flush=True)

result = subprocess.run(
    ["modal", "run", "modal_project/app.py::run_full_pipeline"],
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
    encoding="utf-8",
    errors="replace",
    env=env,
)

# Write to UTF-8 file (avoids console encoding issues)
log_path = "C:/Users/yoann/AppData/Local/Temp/modal_output.txt"
with open(log_path, "w", encoding="utf-8") as f:
    f.write(result.stdout)

# Print sanitized summary to console
lines = result.stdout.split("\n")
for line in lines:
    # Sanitize: keep only ASCII-safe chars for console
    safe = line.encode("ascii", errors="replace").decode("ascii")
    print(safe)

print(f"\nExit code: {result.returncode}")
print(f"Full log: {log_path}")
sys.exit(result.returncode)