Skip to content

Commit

Permalink
Merge pull request #919 from Capsize-Games/devastator
Browse files Browse the repository at this point in the history
Devastator
  • Loading branch information
w4ffl35 authored Oct 9, 2024
2 parents b3f511a + 218946f commit f994853
Show file tree
Hide file tree
Showing 11 changed files with 668 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
.idea
lib
dist
build
90 changes: 90 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
FROM ubuntu:22.04 as base_image
USER root
ENV TZ=America/Denver
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apt-get update \
&& apt-get upgrade -y \
&& apt install software-properties-common -y \
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt install libtinfo6 -y \
&& apt-get install -y git \
&& apt-get install -y wget \
&& apt-get install -y software-properties-common \
&& apt-get install -y gcc-9 \
&& apt-get install -y g++-9 \
&& apt-get install -y bash \
&& apt-get install -y build-essential \
&& apt-get install -y libssl-dev \
&& apt-get install -y libffi-dev \
&& apt-get install -y libgl1-mesa-dev \
&& apt-get install -y fonts-noto-color-emoji \
&& apt-get install -y libportaudio2 \
&& apt-get install -y libxcb-cursor0 \
&& apt-get install -y espeak \
&& apt-get install -y xclip \
&& apt-get install -y libjpeg-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libpng-dev \
&& apt-get install patchelf -y \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt update \
&& apt install python3.10 -y \
&& apt install python3.10-distutils -y \
&& apt install python3-pip -y \
&& apt install python3.10-tk -y \
&& apt install -y upx \
&& apt-get install patchelf -y \
&& apt-get install ccache -y \
&& apt-get install -y libxcb-xinerama0 \
&& apt-get install qt6-qpa-plugins -y \
&& apt-get install libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender-dev libxcb-xinerama0 -y \
&& apt-get install -y qt6-base-dev \
&& apt-get install -y gstreamer1.0-gl \
&& rm -rf /var/lib/apt/lists/ \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 \
&& rm -rf /var/lib/apt/lists/*

FROM base_image as install_requirements
USER root
WORKDIR /app
RUN pip install nvidia-pyindex
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install --upgrade wheel
RUN pip install requests aihandler cmake
RUN pip uninstall torch torchvision -y
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 --upgrade

FROM install_requirements as fix_tcl
USER root
RUN ln -s /usr/share/tcltk/tcl8.6 /usr/share/tcltk/tcl8

FROM fix_tcl as install_apps
RUN python3 -c "from accelerate.utils import write_basic_config; write_basic_config(mixed_precision='fp16')"
RUN pip uninstall nvidia-cublas-cu11 nvidia-cublas-cu12 -y
RUN pip uninstall xformers -y

FROM install_apps as more_env
WORKDIR /app
ENV PATH="/usr/local/lib/python3.10:/usr/local/lib/python3.10/bin:${PATH}"
ENV PYTHONPATH="/usr/local/lib/python3.10:/usr/local/lib/python3.10/bin:${PYTHONPATH}"
RUN pip install pyinstaller

FROM more_env as build_files
WORKDIR /app
COPY dobuild.py dobuild.py
COPY build.sh build.sh
COPY setup.py setup.py


FROM build_files as build_airunner
RUN git clone https://github.com/Capsize-Games/airunner.git /app/airunner \
&& cd /app/airunner \
&& git checkout master \
&& git pull \
&& python3 -m pip install .

FROM build_airunner as build_airunner_executable
COPY build.airunner.linux.prod.spec build.airunner.linux.prod.spec
116 changes: 66 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@

---

# AI RUNNER
# AI Runner

---

## Run AI models on your own hardware
AI Runner is an interface which allows you to run open-source large language models (LLM) and AI image generators (Stable Diffusion) on your own hardware.

It is designed to be easy to use, with a simple and intuitive interface that allows you to run AI models without the need for a web server or cloud service.

It has been optimized for speed and efficiency, allowing you to generate images and have conversations with chatbots in real-time.

### Stable Diffusion
## Stable Diffusion

![img.png](img.png)

### Customizable Chatbots with Moods and Personalities
## Customizable Chatbots with Moods and Personalities

![img_1.png](img_1.png)

Expand All @@ -31,36 +34,36 @@
AI Runner is an AI interface which allows you to run open-source
large language models (LLM) and AI image generators (Stable Diffusion) on your own hardware.

| Feature | Description |
|----------------------------------------|----------------------------------------------------------|
| 🗣️ **LLMs and communication** |
| Voice-based chatbot conversations | Have conversations with a chatbot using your voice |
| Text-to-speech | Convert text to spoken audio |
| Speech-to-text | Convert spoken audio to text |
| Customizable chatbots with LLMs | Generate text using large language models |
| RAG on local documents and websites | Interact with your local documents using an LLM |
| 🎨 **Image Generation** |
| Stable Diffusion (all versions) | Generate images using Stable Diffusion |
| Drawing tools | Turn sketches into art |
| Text-to-Image | Generate images from textual descriptions |
| Image-to-Image | Generate images based on input images |
| 🖼️ **Image Manipulation** |
| Inpaint and Outpaint | Modify parts of an image while maintaining context |
| Controlnet | Control image generation with additional input |
| LoRA | Efficiently fine-tune models with LoRA |
| Textual Embeddings | Use textual embeddings for image generation control |
| Image Filters | Blur, film grain, pixel art and more |
| 🔧 **Utility** |
| Run offline, locally | Run on your own hardware without internet |
| Fast generation | Generate images in ~2 seconds (RTX 2080s) |
| Run multiple models at once | Utilize multiple models simultaneously |
| Dark mode | Comfortable viewing experience in low-light environments |
| Infinite scrolling canvas | Seamlessly scroll through generated images |
| NSFW filter toggle | Help control the visibility of NSFW content |
| NSFW guardrails toggle | Help prevent generation of LLM harmful content |
| Fully customizable | Easily adjust all parameters |
| Fast load time, responsive interface | Enjoy a smooth and responsive user experience |
| Pure python | No reliance on a webserver, pure python implementation |
| Feature | Description |
|--------------------------------------|----------------------------------------------------------|
| 🗣️ **LLMs and communication** |
| Voice-based chatbot conversations | Have conversations with a chatbot using your voice |
| Text-to-speech | Convert text to spoken audio |
| Speech-to-text | Convert spoken audio to text |
| Customizable chatbots with LLMs | Generate text using large language models |
| RAG on local documents and websites | Interact with your local documents using an LLM |
| 🎨 **Image Generation** |
| Stable Diffusion (all versions) | Generate images using Stable Diffusion |
| Drawing tools | Turn sketches into art |
| Text-to-Image | Generate images from textual descriptions |
| Image-to-Image | Generate images based on input images |
| 🖼️ **Image Manipulation** |
| Inpaint and Outpaint | Modify parts of an image while maintaining context |
| Controlnet | Control image generation with additional input |
| LoRA | Efficiently fine-tune models with LoRA |
| Textual Embeddings | Use textual embeddings for image generation control |
| Image Filters | Blur, film grain, pixel art and more |
| 🔧 **Utility** |
| Run offline, locally | Run on your own hardware without internet |
| Fast generation | Generate images in ~2 seconds (RTX 2080s) |
| Run multiple models at once | Utilize multiple models simultaneously |
| Dark mode | Comfortable viewing experience in low-light environments |
| Infinite scrolling canvas | Seamlessly scroll through generated images |
| NSFW filter toggle | Help control the visibility of NSFW content |
| NSFW guardrails toggle | Help prevent generation of LLM harmful content |
| Fully customizable | Easily adjust all parameters |
| Fast load time, responsive interface | Enjoy a smooth and responsive user experience |
| Pure python | No reliance on a webserver, pure python implementation |

---

Expand All @@ -86,7 +89,9 @@ large language models (LLM) and AI image generators (Stable Diffusion) on your o

---

## 🔧 Installation
## 🔧 Running AI Runner from source

Running AI Runner from source is recommended for developers and users who want to test the latest features.

### Linux

Expand Down Expand Up @@ -118,33 +123,42 @@ python3 -m venv airunner
source airunner/bin/activate
```

Install AI Runner
Install the required packages

```bash
pip install -e .
```

---
Run AI Runner

## 🚀 Running AI Runner
```bash
airunner
```

### Linux
---

## Using AI Runner as a Python library

Activate the virtual environment
AI Runner can be used as a Python library in order to extend its functionality.

```bash
source airunner/bin/activate
pip install airunner
```

Run AI Runner
Now you can import AI Runner into your Python scripts.

```bash
cd airunner/src/airunner
./main.py
```python
from airunner import airunner
```

---

## Packaging AI Runner

[Detailed packaging instructions can be found in the wiki](https://github.com/Capsize-Games/airunner/wiki/Installation-instructions).

---

## Models

AI Runner installs all of the models required to run a chatbot with text-to-speech and speech-to-text capabilities,
Expand Down Expand Up @@ -177,7 +191,7 @@ Models must be placed in their respective directories in the `airunner` director

---

### Privacy and Security
## Privacy and Security

Although AI Runner v3.0 is built with Huggingface libraries, we have taken
care to strip the application of any telemetry or tracking features.
Expand Down Expand Up @@ -209,9 +223,7 @@ For more information see `src/security/restrict_os_access.py`.

### Huggingface Hub

The Huggingface Hub is installed so that Transformers, Diffusers and other Huggingface libraries
will continue to function as expected, however it has been neutered to prevent it from accessing
the internet.
**_Huggingface Hub contains telemetry and tracking features that have been completely disabled in AI Runner._**

The security measures taken for this library are as follows

Expand All @@ -221,3 +233,7 @@ The security measures taken for this library are as follows
- All telemetry disabled

See [Facehuggershield](https://github.com/capsize-games/facehuggershield) for more information.

---

sudo groupadd docker
Loading

0 comments on commit f994853

Please sign in to comment.