""" Train LLM From Scratch β control panel (Home). Run with: streamlit run ui/app.py """ from __future__ import annotations import os import streamlit as st from ui import jobs, theme from ui.stages import ABS_DOC, STAGES theme.setup_page("Control Panel", "π§ ") theme.hero("π§ Train LLM From Scratch β Control Panel", "Pretrain β SFT β Reward Model β DPO β PPO β GRPO Β· evaluate Β· chat β all from one place.") # Master pipeline diagram (the hand-drawn overview). overview = ABS_DOC("docs/diagrams/00_overview.png") if os.path.exists(overview): st.image(overview, use_container_width=True) st.markdown( "Use the **pages in the sidebar** to prepare data, configure and launch each training stage " "(with live logs + metric charts), evaluate on GSM8K, and chat with any checkpoint." ) # --- GPU status --- st.subheader("π₯οΈ GPUs") gpus = theme.gpu_status() if gpus: cols = st.columns(len(gpus)) for col, (i, name, used, total, util) in zip(cols, gpus): col.metric(f"GPU {i} Β· {name.split(' ')[-1]}", f"{used/1024:.0f}/{total/1024:.0f} GB", f"{util}% util") else: st.info("No GPUs detected (nvidia-smi unavailable) β CPU / smoke mode only.") # --- Job status --- st.subheader("π Jobs") busy = jobs.gpu_busy() if busy: st.warning(f"A GPU job is currently running: **{busy}**. Other GPU launches are guarded until it finishes.") active = jobs.active_jobs() if active: for rec in active: s = jobs.status(rec["job_id"]) st.markdown( f'
{" ".join(rec["cmd"][:3])} β¦