Download run_intelligent_framework.py from Aravindhan11/Distributed-Transformer-Framework: direct link, hf CLI and curl.
- Browser
- Download file 3.37 kB
-
https://huggingface.co/spaces/Aravindhan11/Distributed-Transformer-Framework/resolve/main/run_intelligent_framework.py
- Command line
-
hf download hf://spaces/Aravindhan11/Distributed-Transformer-Framework/run_intelligent_framework.py
-
curl -L -o run_intelligent_framework.py https://huggingface.co/spaces/Aravindhan11/Distributed-Transformer-Framework/resolve/main/run_intelligent_framework.py
3.37 kB
| import os | |
| import sys | |
| import subprocess | |
| import time | |
| import webbrowser | |
| def print_banner(): | |
| banner = """ | |
| ====================================================================== | |
| βββββ βββ ββ ββββββββ ββ ββββββ ββββββ βββββ ββ ββ ββ | |
| ββ ββ ββββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ | |
| βββββββ ββ ββ ββ ββ ββ ββ βββ ββββββ βββββββ ββββ ββ | |
| ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ | |
| ββ ββ ββ ββββ ββ ββ ββββββ ββ ββ ββ ββ ββ ββ | |
| ====================================================================== | |
| INTELLIGENT LLM HUB - DISTRIBUTED TRANSFORMER FRAMEWORK | |
| ====================================================================== | |
| * Loaded with: Hugging Face Weights Bridge (Bi-directional) | |
| * Feature suite: Autoregressive Streaming Inference & Live Sampler | |
| * Training suite: Fine-tuning console + Dynamic Loss Chart | |
| * Destination Hub: Host & upload directly to profile 'Aravindhan11' | |
| ====================================================================== | |
| """ | |
| print(banner) | |
| def main(): | |
| print_banner() | |
| # Check if inside directory | |
| current_dir = os.path.dirname(os.path.abspath(__file__)) | |
| server_path = os.path.join(current_dir, "server.py") | |
| if not os.path.exists(server_path): | |
| print(f"Error: Could not locate server.py in {current_dir}. Please run from the root directory.") | |
| sys.exit(1) | |
| print("Checking dependencies...") | |
| try: | |
| import torch | |
| import transformers | |
| import datasets | |
| print("-> Core dependencies (PyTorch, Transformers, Datasets) verified successfully.") | |
| except ImportError as e: | |
| print(f"Error: Missing core dependency. Please run 'uv sync' or install manually:\n pip install torch transformers datasets rich") | |
| sys.exit(1) | |
| port = 8000 | |
| print(f"\nStarting API Server on port {port}...") | |
| # Start server.py in a subprocess | |
| # Using sys.executable to ensure we use the same Python interpreter | |
| try: | |
| process = subprocess.Popen( | |
| [sys.executable, server_path, str(port)], | |
| cwd=current_dir | |
| ) | |
| # Give the server a second to boot up | |
| time.sleep(2) | |
| # Open web browser | |
| url = f"http://localhost:{port}" | |
| print(f"\n-> Launching your Web Dashboard at: {url}") | |
| print("-> Press Ctrl+C in this terminal to stop the server and close the dashboard.") | |
| webbrowser.open(url) | |
| # Wait for the subprocess to finish | |
| process.wait() | |
| except KeyboardInterrupt: | |
| print("\n\nShutting down Intelligent Framework Hub...") | |
| try: | |
| process.terminate() | |
| process.wait(timeout=3) | |
| except Exception: | |
| pass | |
| print("Server stopped. Goodbye!") | |
| except Exception as e: | |
| print(f"Error running the command center: {e}") | |
| if __name__ == "__main__": | |
| main() | |