π OS Launch: Clean documentation and refined licensing
Browse filesThis OS launch commit includes:
β
**Cleaned Documentation**
- Removed inflated claims and marketing language
- Added honest research status and limitations
- Created professional model card and validation reports
- Streamlined licensing to AGPLv3 + commercial contact
β
**Refined Codebase**
- Complete experimental bit-native transformer implementation
- 57 Python files with comprehensive research framework
- Safety telemetry and monitoring systems
- Distributed training and development tools
β
**Professional Standards**
- Empirical validation of all claims
- Clear experimental vs production distinctions
- Rigorous research methodology requirements
- Community contribution framework
Ready for serious research evaluation and academic investigation.
- launch_dual_dashboard.py +150 -0
launch_dual_dashboard.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
BitTransformerLM Dual Dashboard Launcher
|
| 4 |
+
========================================
|
| 5 |
+
|
| 6 |
+
Launch both Flask and Gradio dashboards simultaneously for maximum flexibility.
|
| 7 |
+
- Flask Dashboard: http://localhost:5000 (Docker/production compatible)
|
| 8 |
+
- Gradio Dashboard: http://localhost:7860 (HuggingFace Spaces compatible)
|
| 9 |
+
- MCP Server: http://localhost:8000 (if enabled)
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import os
|
| 13 |
+
import sys
|
| 14 |
+
import time
|
| 15 |
+
import threading
|
| 16 |
+
import subprocess
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
# Add current directory to path
|
| 20 |
+
sys.path.insert(0, str(Path(__file__).parent))
|
| 21 |
+
|
| 22 |
+
def launch_flask_dashboard():
|
| 23 |
+
"""Launch the Flask dashboard in a separate thread."""
|
| 24 |
+
print("π Starting Flask Dashboard...")
|
| 25 |
+
try:
|
| 26 |
+
os.environ["FLASK_ENV"] = "development"
|
| 27 |
+
|
| 28 |
+
# Import and run Flask app
|
| 29 |
+
from bit_transformer.dashboard_app import app
|
| 30 |
+
app.run(host="127.0.0.1", port=5000, debug=False, use_reloader=False)
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print(f"β Flask dashboard failed: {e}")
|
| 33 |
+
|
| 34 |
+
def launch_gradio_dashboard():
|
| 35 |
+
"""Launch the Gradio dashboard in a separate thread."""
|
| 36 |
+
print("π¨ Starting Gradio Dashboard...")
|
| 37 |
+
try:
|
| 38 |
+
from gradio_dashboard import run_gradio_server
|
| 39 |
+
run_gradio_server(host="127.0.0.1", port=7860, share=False)
|
| 40 |
+
except Exception as e:
|
| 41 |
+
print(f"β Gradio dashboard failed: {e}")
|
| 42 |
+
|
| 43 |
+
def launch_mcp_server():
|
| 44 |
+
"""Launch the MCP server if requested."""
|
| 45 |
+
print("π Starting MCP Server...")
|
| 46 |
+
try:
|
| 47 |
+
from mcp_server import app as mcp_app
|
| 48 |
+
mcp_app.run(host="127.0.0.1", port=8000, debug=False, use_reloader=False)
|
| 49 |
+
except Exception as e:
|
| 50 |
+
print(f"β MCP server failed: {e}")
|
| 51 |
+
|
| 52 |
+
def main():
|
| 53 |
+
"""Main launcher function."""
|
| 54 |
+
print("π BitTransformerLM Dual Dashboard Launcher")
|
| 55 |
+
print("=" * 50)
|
| 56 |
+
|
| 57 |
+
# Check requirements
|
| 58 |
+
try:
|
| 59 |
+
import flask
|
| 60 |
+
import gradio
|
| 61 |
+
print(f"β
Flask {flask.__version__} and Gradio {gradio.__version__} are available")
|
| 62 |
+
except ImportError as e:
|
| 63 |
+
print(f"β Missing dependencies: {e}")
|
| 64 |
+
print("Please run: pip install -r requirements-gradio.txt")
|
| 65 |
+
return
|
| 66 |
+
|
| 67 |
+
# Configuration
|
| 68 |
+
enable_flask = os.getenv("ENABLE_FLASK", "true").lower() == "true"
|
| 69 |
+
enable_gradio = os.getenv("ENABLE_GRADIO", "true").lower() == "true"
|
| 70 |
+
enable_mcp = os.getenv("ENABLE_MCP", "false").lower() == "true"
|
| 71 |
+
|
| 72 |
+
print(f"π§ Configuration:")
|
| 73 |
+
print(f" Flask Dashboard: {'Enabled' if enable_flask else 'Disabled'}")
|
| 74 |
+
print(f" Gradio Dashboard: {'Enabled' if enable_gradio else 'Disabled'}")
|
| 75 |
+
print(f" MCP Server: {'Enabled' if enable_mcp else 'Disabled'}")
|
| 76 |
+
print()
|
| 77 |
+
|
| 78 |
+
# Launch threads
|
| 79 |
+
threads = []
|
| 80 |
+
|
| 81 |
+
if enable_flask:
|
| 82 |
+
flask_thread = threading.Thread(target=launch_flask_dashboard, daemon=True)
|
| 83 |
+
flask_thread.start()
|
| 84 |
+
threads.append(("Flask", flask_thread))
|
| 85 |
+
time.sleep(2) # Stagger startup
|
| 86 |
+
|
| 87 |
+
if enable_mcp:
|
| 88 |
+
# Set MCP server address for other components
|
| 89 |
+
os.environ["MCP_SERVER_ADDR"] = "http://localhost:8000"
|
| 90 |
+
mcp_thread = threading.Thread(target=launch_mcp_server, daemon=True)
|
| 91 |
+
mcp_thread.start()
|
| 92 |
+
threads.append(("MCP", mcp_thread))
|
| 93 |
+
time.sleep(2) # Stagger startup
|
| 94 |
+
|
| 95 |
+
if enable_gradio:
|
| 96 |
+
gradio_thread = threading.Thread(target=launch_gradio_dashboard, daemon=True)
|
| 97 |
+
gradio_thread.start()
|
| 98 |
+
threads.append(("Gradio", gradio_thread))
|
| 99 |
+
|
| 100 |
+
# Wait for startup
|
| 101 |
+
time.sleep(3)
|
| 102 |
+
|
| 103 |
+
# Print access URLs
|
| 104 |
+
print("π Access URLs:")
|
| 105 |
+
if enable_flask:
|
| 106 |
+
print(" Flask Dashboard: http://localhost:5000")
|
| 107 |
+
if enable_gradio:
|
| 108 |
+
print(" Gradio Dashboard: http://localhost:7860")
|
| 109 |
+
if enable_mcp:
|
| 110 |
+
print(" MCP Server: http://localhost:8000")
|
| 111 |
+
print()
|
| 112 |
+
|
| 113 |
+
print("π‘ Usage Tips:")
|
| 114 |
+
print(" β’ Flask dashboard: Full Docker/production compatibility")
|
| 115 |
+
print(" β’ Gradio dashboard: HuggingFace Spaces ready interface")
|
| 116 |
+
print(" β’ MCP server: Programmatic API access")
|
| 117 |
+
print(" β’ Both dashboards share the same model state")
|
| 118 |
+
print(" β’ Press Ctrl+C to stop all services")
|
| 119 |
+
print()
|
| 120 |
+
|
| 121 |
+
try:
|
| 122 |
+
# Keep main thread alive
|
| 123 |
+
while True:
|
| 124 |
+
time.sleep(1)
|
| 125 |
+
except KeyboardInterrupt:
|
| 126 |
+
print("\nπ Shutting down all services...")
|
| 127 |
+
# Threads will be cleaned up automatically as they are daemon threads
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
import argparse
|
| 131 |
+
|
| 132 |
+
parser = argparse.ArgumentParser(description="BitTransformerLM Dual Dashboard")
|
| 133 |
+
parser.add_argument("--flask-only", action="store_true", help="Launch only Flask dashboard")
|
| 134 |
+
parser.add_argument("--gradio-only", action="store_true", help="Launch only Gradio dashboard")
|
| 135 |
+
parser.add_argument("--enable-mcp", action="store_true", help="Enable MCP server")
|
| 136 |
+
|
| 137 |
+
args = parser.parse_args()
|
| 138 |
+
|
| 139 |
+
# Override environment based on args
|
| 140 |
+
if args.flask_only:
|
| 141 |
+
os.environ["ENABLE_FLASK"] = "true"
|
| 142 |
+
os.environ["ENABLE_GRADIO"] = "false"
|
| 143 |
+
elif args.gradio_only:
|
| 144 |
+
os.environ["ENABLE_FLASK"] = "false"
|
| 145 |
+
os.environ["ENABLE_GRADIO"] = "true"
|
| 146 |
+
|
| 147 |
+
if args.enable_mcp:
|
| 148 |
+
os.environ["ENABLE_MCP"] = "true"
|
| 149 |
+
|
| 150 |
+
main()
|