Skip to content

Commit

Permalink
Runing Image Generator On Akash (akash-network#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfset authored Jul 13, 2023
1 parent b395a98 commit dbde957
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 0 deletions.
20 changes: 20 additions & 0 deletions AI-Image-App/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM pytorch/pytorch:latest

RUN apt-get update && apt-get install -y --no-install-recommends \
git && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Pipfile Pipfile.lock .
RUN pip install pipenv && \
pipenv install --system

COPY scripts scripts
COPY core core

VOLUME /data

ENV FLASK_APP=scripts/web.py

CMD ["flask", "run", "--port", "3000", "--host", "0.0.0.0"]
52 changes: 52 additions & 0 deletions AI-Image-App/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# AI-Art

![AI-Art Screenshot](./Screenshot(234).png)

Art generation using VQGAN + CLIP using docker containers. A simplified,
updated, and expanded upon version of
[Kevin Costa's work](https://github.com/kcosta42/VQGAN-CLIP-Docker). This
project tries to make generating art as easy as possible for anyone with a GPU
by providing a simple web UI.


## Samples

For samples check out the [AI Generated](http://1j0gql7905agf792r45ae0hl68.ingress.akashost.com/) section
on the art page on website.


## Using ai-art

This works best if you have an NVIDIA GPU however there is a fallback CPU mode included. I've found the CPU mode to take significantly longer than even the most basic of GPUs though.


### Quick start usage
For running just deploy [this SDL](https://github.com/alfset/awesome-akash/blob/master/AI-Image-App/deploy.yaml) and wait for the models to finish loading, watching the process in the logs.

### Logs

![Checking Logs](./Screenshot(232).png)

### Check GPU resources has been used

![Checking GPU resources](./Screenshot(233).png)

## Image sizes

The larger the image the more VRAM your graphics card needs:

- 6 GB of VRAM is required to generate 256x256 images.
- 12 GB of VRAM is required to generate 512x512 images.
- 24 GB of VRAM is required to generate 1024x1024 images.

If you don't know how much VRAM your graphics card has you probably have 6 GB
or less so stick with smaller images.

That being said you can do non-square images if you want as long as you don't
go above the number of pixels your GPU's VRAM supports, for example you could
do ultrawide images with 6 GB of ram at "384x128" or do tall images at "128x384"
and so on. You do not have to use numbers with a power of 2, "300x100" is also
perfectly valid.

## Demo Video
https://github.com/alfset/awesome-akash/blob/master/AI-Image-App/ai-image-app_screen-capture.webm
Binary file added AI-Image-App/Screenshot(232).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AI-Image-App/Screenshot(233).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AI-Image-App/Screenshot(234).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AI-Image-App/ai-image-app_screen-capture.webm
Binary file not shown.
36 changes: 36 additions & 0 deletions AI-Image-App/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
##sdl yaml
version: '2.0'
services:
gpu-app:
image: overshard/ai-art
expose:
- port: 3000
as: 80
to:
- global: true
profiles:
compute:
gpu-app:
resources:
cpu:
units: 1
memory:
size: 38Gi
gpu:
units: 1
attributes:
vendor:
nvidia:
storage:
- size: 100Gi
placement:
westcoast:
pricing:
gpu-app:
denom: uakt
amount: 100000
deployment:
gpu-app:
westcoast:
profile: gpu-app
count: 1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Also, follow [@akashnet\_](https://twitter.com/akashnet_) to stay in the loop wi
- [Weaviate](weaviate)
- [Flan-T5 XXL](flan-t5-xxl)
- [Falcon-7B](Falcon-7B)
- [AI-Image-App](AI-Image-App)

### Blogging

Expand Down

0 comments on commit dbde957

Please sign in to comment.