|
1 | | -# Ampere Optimized AI Playground |
| 1 | + |
| 2 | +<p style="text-align: center; font-size: 2.25rem;"> |
| 3 | +Ampere-Optimized AI Playground |
| 4 | +</p> |
| 5 | + |
| 6 | +The **Ampere Optimized AI Playground** is a Gradio-based interface that allows users to launch and interact with AI demos optimized for Ampere Computing platforms. This project provides a centralized launcher to start and stop three AI demos: LLM Chat (Ollama), Object Detection (YOLOv11), and Speech-to-Text (Whisper). Each demo runs in a Docker container, managed via Docker Compose, and is accessible through a web interface. |
| 7 | + |
| 8 | +## Features |
| 9 | +- **Interactive Gradio UI**: Select and launch demos with a clean, user-friendly interface. |
| 10 | +- **Dockerized Demos**: Each demo runs in its own container for isolation and scalability. |
| 11 | +- **Optimized for Ampere**: Leverages Ampere Computing's hardware for efficient AI workloads. |
| 12 | +- **Easy Start/Stop**: Scripts to start and stop demos with a single command. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | +- **Ubuntu** (Tested on Ubuntu 24.04 or later) |
| 16 | +- **Docker** and **Docker Compose** installed |
| 17 | +- **Ports 7860-7863** open for the Gradio UI and demo services |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +### 1. Install Docker and Docker Compose on Ubuntu |
| 22 | +To set up Docker and Docker Compose, run the following commands in a terminal: |
| 23 | + |
| 24 | +```bash |
| 25 | +# Update package index |
| 26 | +sudo apt-get update |
| 27 | + |
| 28 | +# Install prerequisites |
| 29 | +sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common |
| 30 | + |
| 31 | +# Add Docker's official GPG key |
| 32 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
| 33 | + |
| 34 | +# Add Docker repository |
| 35 | +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 36 | + |
| 37 | +# Install Docker |
| 38 | +sudo apt-get update |
| 39 | +sudo apt-get install -y docker-ce docker-ce-cli containerd.io |
| 40 | + |
| 41 | +# Install Docker Compose |
| 42 | +sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
| 43 | +sudo chmod +x /usr/local/bin/docker-compose |
| 44 | + |
| 45 | +# Add user to Docker group to run Docker without sudo |
| 46 | +sudo usermod -aG docker $USER |
| 47 | +newgrp docker |
| 48 | +``` |
| 49 | + |
| 50 | +After running these commands, log out and back in to apply the group changes. Verify the installation: |
| 51 | + |
| 52 | +```bash |
| 53 | +docker --version |
| 54 | +docker compose --version |
| 55 | +``` |
| 56 | + |
| 57 | +### 2. Clone the Repository |
| 58 | +Clone this repository to your local machine: |
| 59 | + |
| 60 | +```bash |
| 61 | +git clone https://github.com/AmpereComputingAI/ampere-ai-playground.git |
| 62 | +cd ampere-ai-playground |
| 63 | +``` |
| 64 | + |
| 65 | +### 3. Open Firewall Ports |
| 66 | +The playground and demos use ports 7860 (Gradio UI), 7861 (Ollama), 7862 (YOLOv11), and 7863 (Whisper). Open these ports using ```firewall-cmd```: |
| 67 | + |
| 68 | +```bash |
| 69 | +# Ensure firewalld is installed |
| 70 | +sudo apt-get install -y firewalld |
| 71 | + |
| 72 | +# Start and enable firewalld |
| 73 | +sudo systemctl start firewalld |
| 74 | +sudo systemctl enable firewalld |
| 75 | + |
| 76 | +# Open ports 7860-7863 |
| 77 | +sudo firewall-cmd --permanent --add-port=7860-7863/tcp |
| 78 | +sudo firewall-cmd --reload |
| 79 | +``` |
| 80 | + |
| 81 | +Verify the ports are open: |
| 82 | + |
| 83 | +```bash |
| 84 | +sudo firewall-cmd --list-ports |
| 85 | +``` |
| 86 | + |
| 87 | +## Demo Details |
| 88 | +This project includes three AI demos, each optimized for Ampere Computing platforms. Below are details and links to their respective GitHub repositories for further information. |
| 89 | + |
| 90 | +### LLM Chat (Ollama) |
| 91 | +- **Description:** A conversational AI demo using the Ollama framework, optimized for Ampere hardware. |
| 92 | +- **GitHub Repository:** Ollama Chat Demo |
| 93 | +- **Port:** 7861 |
| 94 | +- **Access:** Once launched, access at ```http://<host>:7861``` (use ```localhost``` for local setups or the public IP for cloud instances) |
| 95 | + |
| 96 | +### Object Detection (YOLOv11) |
| 97 | +- **Description:** A real-time object detection demo using YOLOv11, optimized for Ampere hardware. |
| 98 | +- **GitHub Repository:** YOLOv11 Demo |
| 99 | +- **Port:** 7862 |
| 100 | +- **Access:** Once launched, access at ```http://<host>:7862``` (use ```localhost``` for local setups or the public IP for cloud instances) |
| 101 | + |
| 102 | +### Speech-to-Text (Whisper) |
| 103 | +- **Description:** An automatic speech recognition demo using the Whisper model, optimized for Ampere platforms. |
| 104 | +- **GitHub Repository:** Whisper Demo |
| 105 | +- **Port:** 7863 |
| 106 | +- **Access:** Once launched, access at ```http://<host>:7863``` (use ```localhost``` for local setups or the public IP for cloud instances) |
| 107 | + |
| 108 | +## Running the Playground |
| 109 | +### Starting the Playground |
| 110 | +To start the Ampere Optimized AI Playground, use the provided ```start-app.sh``` script: |
| 111 | +```bash |
| 112 | +./start-app.sh |
| 113 | +``` |
| 114 | +This script launches the Gradio interface, which allows you to select and start one of the demos. The interface runs on port 7860. |
| 115 | + |
| 116 | +### Accessing the Playground |
| 117 | +Once the playground is launched, open your web browser and navigate to: |
| 118 | + |
| 119 | +``` |
| 120 | +http://<host>:7860 |
| 121 | +``` |
| 122 | + |
| 123 | +Replace ```<host>``` with ```localhost``` for local setups or the public IP address for cloud instances. From the Gradio UI, select a demo (Ollama, YOLOv11, or Whisper) and click "Launch Demo". The interface will display a link to the live demo (e.g., ```http://<host>:7861``` for Ollama). Click the link to access the running demo. |
| 124 | + |
| 125 | +### Stopping the Demos |
| 126 | +To stop all running demos and the playground, use the provided ```stop-app.sh``` script: |
| 127 | + |
| 128 | +```bash |
| 129 | +./stop-app.sh |
| 130 | +``` |
| 131 | + |
| 132 | +This script stops and removes all demo containers, ensuring a clean state for the next run. Alternatively, you can stop demos directly from the Gradio UI by clicking "Stop All Demos". |
| 133 | + |
| 134 | +### Accessing Live Demos |
| 135 | +Once a demo is launched via the Gradio UI, the interface will display a confirmation message with a URL to the live demo. For example: |
| 136 | +- **Ollama**: ```http://<host>:7861``` |
| 137 | +- **YOLOv11**: ```http://<host>:7862``` |
| 138 | +- **Whisper**: ```http://<host>:7863``` |
| 139 | + |
| 140 | +Replace ```<host>``` with ```localhost``` for local setups or the public IP address for cloud instances. Click the provided link in the Gradio UI to access the demo's web interface. It may take a moment for the demo to become available after launching. |
| 141 | + |
| 142 | +## Troubleshooting |
| 143 | +- **Port Conflicts**: If ports 7860-7863 are in use, stop conflicting services or change the ports in the ```compose.yaml``` file and update ```app.py``` accordingly. |
| 144 | +- **Docker Permissions**: Ensure your user is in the ```docker``` group (```sudo usermod -aG docker $USER```) and log out/in to apply changes. |
| 145 | +- **Demo Fails to Launch**: Check Docker logs for the specific service: |
| 146 | + |
| 147 | +```bash |
| 148 | +docker logs <service_name> |
| 149 | +``` |
| 150 | +Replace ```<service_name>``` with ```ollama_demo_service```, ```yolo_demo_service```, or ```whisper_demo_service```. |
| 151 | + |
| 152 | +## License |
| 153 | +This project is licensed under the MIT License. See the LICENSE file for details. |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
0 commit comments