Marcus/run_marcus.py

37 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""
run_marcus.py — Marcus AI Brain (terminal mode)
Usage: python3 run_marcus.py
"""
import os
import sys
import warnings
# Silence known-harmless third-party deprecation warnings before ANY heavy
# import fires them. Keeps the terminal dashboard readable.
# - TypedStorage : fires from torch during yolov8m.pt checkpoint load
# - torch.ampwhile : fires in ultralytics when FP16 is enabled on Jetson torch 2.1
warnings.filterwarnings("ignore", message=".*TypedStorage is deprecated.*")
warnings.filterwarnings("ignore", message=".*torch\\.cuda\\.amp.*")
os.environ.setdefault("PYTHONWARNINGS", "ignore::UserWarning:torch._utils")
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
# Tell the Linux OOM killer to pick Ollama (easily restarted) or any other
# process before Marcus. -900 is almost-but-not-quite OOM-immune; we don't
# use -1000 because that disables OOM handling entirely, which is risky if
# Marcus ever had a runaway allocation. Writing oom_score_adj doesn't need
# root — a process can always lower its own score.
try:
with open(f"/proc/{os.getpid()}/oom_score_adj", "w") as _f:
_f.write("-900")
except OSError:
pass # not fatal — running under a restrictive sandbox
from Brain.marcus_brain import run_terminal
if __name__ == "__main__":
run_terminal()