diff --git a/.github/workflows/docker-publish-stablediffusion.yaml b/.github/workflows/docker-publish-stablediffusion.yaml new file mode 100644 index 0000000..2af902c --- /dev/null +++ b/.github/workflows/docker-publish-stablediffusion.yaml @@ -0,0 +1,66 @@ +# Adapted from +# https://github.com/actions/starter-workflows/ci/docker-publish.yml +# If using base images, don't forget to add READ access, eg. from a package settings page like: +# https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access +name: Build Stable Diffusion Docker Image +on: + push: + branches: + # NB: Default-branch doesn't work, despite Github's documentation. + #- $default-branch + - master +env: + IMAGE_NAME: stablediffusion + +jobs: + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + #runs-on: ubuntu-latest + runs-on: github-ubuntu-64core # NB: Premium GitHub runner with more cores + if: github.event_name == 'push' + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + #username: ${{ github.repository_owner }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image + run: cd image_generation/Storyteller-Studio-Filter/ && docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + - name: Push image to GitHub Container Registry + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "$default-branch" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-12) + + docker tag $IMAGE_NAME $IMAGE_ID:$SHORT_SHA + docker push $IMAGE_ID:$SHORT_SHA + diff --git a/image_generation/Storyteller-Studio-Filter/Dockerfile b/image_generation/Storyteller-Studio-Filter/Dockerfile new file mode 100644 index 0000000..a10bd25 --- /dev/null +++ b/image_generation/Storyteller-Studio-Filter/Dockerfile @@ -0,0 +1,39 @@ +# Use NVIDIA CUDA with Ubuntu as the base image +FROM nvidia/cuda:12.2.0-devel-ubuntu20.04 + +# Set environment variables +ENV MY_ENV_VARIABLE=value +ENV DEBIAN_FRONTEND=noninteractive + +RUN mkdir /python_install +RUN mkdir /model_code + +WORKDIR /python_install + +# Install necessary packages +RUN apt-get update && apt-get install -y \ + curl \ + software-properties-common \ + git \ + ffmpeg \ + espeak-ng \ + sudo + +# rsync to copy between pods with rich logs +RUN apt-get install -y rsync + +RUN add-apt-repository ppa:deadsnakes/ppa + +RUN apt-get update +RUN apt-get install -y python3.10 python3.10-venv python3.10-dev python3.10-full python3.10-distutils + +COPY requirements.txt . +# Install Python dependencies +RUN python3.10 -m venv python \ + && python/bin/pip install --upgrade pip wheel setuptools \ + && . python/bin/activate \ + && pip install -r requirements.txt + +WORKDIR /model_code + +COPY . . \ No newline at end of file diff --git a/image_generation/Storyteller-Studio-Filter/json-example.json b/image_generation/Storyteller-Studio-Filter/json-example.json new file mode 100644 index 0000000..63a849a --- /dev/null +++ b/image_generation/Storyteller-Studio-Filter/json-example.json @@ -0,0 +1,19 @@ + +{ + "uuid_idempotency_token": "11", + "type_of_inference": "inference", + "maybe_sd_model_token": "weight_dmmthavhawqc2hj7yqyemcbf8", + "maybe_lora_model_token": "weight_t7gz78fjg27m0wtw6r33gafxs", + "maybe_prompt": "raiden mei a very well drawn, anime girl, with pink and purple hair sitting down on a chair relaxed, highest quality, semi nude, masterpiece, painted", + "maybe_a_prompt": "a anime girl, with pink and purple hair sitting down on a chair relaxed.", + "maybe_n_prompt": "nsfw, black and white, low quality, pixelated", + "maybe_seed": -1, + "maybe_width": 1024, + "maybe_height": 1024, + "maybe_sampler": "DPM++ 2M SDE Heun", + "maybe_upload_path": "https://drive.google.com/file/d/1WRgR2pn0Ky8ls5_9Zq6tQlHTBvyWeach/view?usp=sharing", + "maybe_lora_upload_path": "https://drive.google.com/file/d/1WRgR2pn0Ky8ls5_9Zq6tQlHTBvyWeach/view?usp=sharing", + "maybe_cfg_scale": 7, + "maybe_number_of_samples": 64, + "maybe_batch_count": 4 + } \ No newline at end of file