# ๐Ÿš€ QUICK START - 5 EASY STEPS ## โœ… SERVER IS ALREADY RUNNING! Your FastAPI server is **currently active** at: ``` http://localhost:8000 ``` --- ## ๐Ÿ“‹ STEP-BY-STEP RUN GUIDE ### STEP 1: Open Terminal ```powershell # Open PowerShell or Command Prompt # Navigate to project directory cd "d:\Projects\Pytorch x hugging face\he_demo" ``` ### STEP 2: Start Virtual Environment (Optional) ```powershell # Activate Python virtual environment .venv\Scripts\Activate.ps1 ``` ### STEP 3: Run the Server ```powershell # Start FastAPI server with uv uv run server ``` **Expected Output:** ``` INFO: Started server process [pid] INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) ``` ### STEP 4: Verify Server is Running (New Terminal) ```powershell # In a new terminal, test the API curl http://localhost:8000/graders # Or with PowerShell Invoke-WebRequest -Uri "http://localhost:8000/graders" -UseBasicParsing ``` **Expected Response:** ```json { "graders": {...}, "total_graders": 5, "grader_names": [...] } ``` ### STEP 5: Run Validation Tests ```powershell # Test environment and graders python validate.py # Or comprehensive tests python validate_comprehensive.py ``` **Expected Output:** ``` โœ… Grader count requirement met (>= 3) โœ… All validation tests passed โœ… 5 graders WORKING ``` --- ## ๐Ÿงช TEST COMMANDS (While Server Running) ### Test 1: Check All Graders ```powershell curl http://localhost:8000/graders ``` ### Test 2: Get Specific Grader ```powershell curl "http://localhost:8000/graders/balanced_optimization" ``` ### Test 3: Get Grader Info ```powershell curl http://localhost:8000/graders/info ``` ### Test 4: Reset Environment ```powershell curl -X POST http://localhost:8000/reset ` -H "Content-Type: application/json" ` -d '{}' ``` ### Test 5: Execute Action ```powershell curl -X POST http://localhost:8000/step ` -H "Content-Type: application/json" ` -d '{"action_type": "reduce_ram", "intensity": 0.8}' ``` --- ## ๐ŸŽ“ TRAINING & INFERENCE ### Run Training Script ```powershell python train_agent.py ``` - Trains RL agent on environment - Evaluates with graders - Saves model as `energy_optimization_ppo.zip` ### Run Inference Script ```powershell # Set environment variables first $env:ENERGY_TASK = "balanced_optimization" $env:HF_TOKEN = "your_token" $env:MODEL_NAME = "Qwen/Qwen2.5-72B-Instruct" # Then run python -m he_demo.inference ``` --- ## ๐Ÿณ RUN WITH DOCKER (Alternative) ### Build Docker Image ```powershell docker build -t energy-optimization-env . ``` ### Run Docker Container ```powershell # Port 8000 on your machine maps to 8000 in container docker run -p 8000:8000 he_demo:latest # Or with interactive terminal docker run -it -p 8000:8000 he_demo:latest ``` --- ## โน๏ธ STOP THE SERVER ```powershell # In the terminal running the server: Press CTRL+C # Or if running Docker: docker stop ``` --- ## ๐Ÿ“Š VERIFY EVERYTHING WORKS Run this quick verification: ```powershell # 1. Check server status curl http://localhost:8000/graders # 2. Run validation python validate.py # 3. Check all graders python validate_comprehensive.py ``` All three should โœ… PASS --- ## ๐ŸŽฏ WHAT'S RUNNING | Component | Status | Port | Command | |-----------|--------|------|---------| | **FastAPI Server** | โœ… RUNNING | 8000 | `uv run server` | | **5 Graders** | โœ… ACTIVE | 8000/graders | Built-in | | **WebSocket** | โœ… READY | 8000/ws | Real-time updates | | **Validation** | โœ… READY | N/A | `python validate.py` | --- ## ๐Ÿ”— IMPORTANT LINKS - **Local Server**: http://localhost:8000 - **GitHub Repo**: https://github.com/Sushruth-21/Energy-and-Memory-Ram-Optimization - **HF Space**: https://sushruth21-energy-optimization-space.hf.space - **Complete Guide**: See RUN_INSTRUCTIONS.md --- ## โœ… TROUBLESHOOTING ### Port 8000 already in use? ```powershell # Find process using port netstat -ano | findstr :8000 # Kill process taskkill /PID /F ``` ### Module not found error? ```powershell # Reinstall dependencies uv sync ``` ### Docker image not building? ```powershell # Use pre-built image docker run -p 8000:8000 he_demo:latest ``` --- ## ๐ŸŽ‰ YOU'RE READY! 1. โœ… Server is running 2. โœ… 5 Graders are working 3. โœ… API is responding 4. โœ… Ready to submit to hackathon **Next: Run validation tests and submit!** --- **Current Server Status**: ๐ŸŸข **RUNNING ON http://localhost:8000**