Skip to content

Commit

Permalink
Improve scripts, readd vllm, add new iso build mode - "gui", update …
Browse files Browse the repository at this point in the history
…repositories, etc (#32)

* Improve repository updating scripts

* Move patches to homedir, do not apply them

* Update patches

* Refactor

* Add gui type, fixes

* Job concurrency fixes

* Fix patch

* Do not force terminate VM

* Disable automatic workflow launch for selfhosted runner

* Fix vllm buildscript

* define CUDA_ARCHITECTURES env var

* Remove CUDACXX

* Fixes (?)

* Fix pytorch issue

* specify CUDAHOSTCXX

* Fix

* Remove xorg drivers, add xorg config

* Update repositories, actions fixes

* Fixes

* Change menu

* Add image to README.md

* Add ST to README.md
  • Loading branch information
sasha0552 authored Apr 25, 2024
1 parent 9c1085e commit f5eb989
Show file tree
Hide file tree
Showing 42 changed files with 786 additions and 147 deletions.
4 changes: 3 additions & 1 deletion .ci/actions.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def main():
# render templates
render_template(f"{i}/gh-build-iso.yml.jinja2", f"{o}/gh-build-iso-cuda.yml" , platform="cuda", type="normal")
render_template(f"{i}/gh-build-iso.yml.jinja2", f"{o}/gh-build-iso-cuda-empty.yml", platform="cuda", type="empty")
render_template(f"{i}/sh-build-iso.yml.jinja2", f"{o}/sh-build-iso-rocm.yml" , platform="rocm", type="normal")
render_template(f"{i}/gh-build-iso.yml.jinja2", f"{o}/gh-build-iso-cuda-gui.yml" , platform="cuda", type="gui")
render_template(f"{i}/sh-build-iso.yml.jinja2", f"{o}/sh-build-iso-rocm.yml" , platform="rocm", type="normal", delay=0)
render_template(f"{i}/gh-build-iso.yml.jinja2", f"{o}/gh-build-iso-rocm-empty.yml", platform="rocm", type="empty")
render_template(f"{i}/sh-build-iso.yml.jinja2", f"{o}/sh-build-iso-rocm-gui.yml" , platform="rocm", type="gui", delay=30)

if __name__ == "__main__":
main()
16 changes: 15 additions & 1 deletion .ci/configure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

import configparser
import glob
import jinja2
import sys
Expand All @@ -24,6 +25,9 @@ def main():
# and normal iso
type = "normal"

# and empty options
options = {}

# set platform
if len(sys.argv) >= 2:
platform = sys.argv[1]
Expand All @@ -32,6 +36,16 @@ def main():
if len(sys.argv) >= 3:
type = sys.argv[2]

# load options
config = configparser.ConfigParser()
config.read(".ci/options.ini")

# repositories
options["repositories"] = dict(config.items("repositories"))

# revisions
options["revisions"] = dict(config.items("revisions"))

# list of rendered files
rendered = []

Expand All @@ -41,7 +55,7 @@ def main():
rendered.sort()

# render file
render_template(filepath, platform=platform, type=type, rendered=rendered)
render_template(filepath, platform=platform, type=type, rendered=rendered, **options)

# add output file to rendered list
rendered.append(filepath[:-7].replace("\\", "/"))
Expand Down
22 changes: 22 additions & 0 deletions .ci/options.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[repositories]
automatic = https://github.com/vladmandic/automatic.git
axolotl = https://github.com/OpenAccess-AI-Collective/axolotl.git
comfyui = https://github.com/comfyanonymous/ComfyUI.git
koboldcpp = https://github.com/LostRuins/koboldcpp.git
llamacpp = https://github.com/ggerganov/llama.cpp.git
sillytavern = https://github.com/SillyTavern/SillyTavern.git
sillytavern_extras = https://github.com/SillyTavern/SillyTavern-Extras.git
text_generation_webui = https://github.com/oobabooga/text-generation-webui.git
vllm = https://github.com/vllm-project/vllm.git

[revisions]
automatic = de267390905335d353deab3e9ac2031432f4d305
axolotl = 68601ec6ad1cc0e8cb855376586e6eef6a8aa270
comfyui = 8dc19e40d129c8ee049be7be2657458509717ba5
koboldcpp = 593f08bb78ab6035f91cc7aa753975254f30ed82
llamacpp = 784e11dea1f5ce9638851b2b0dddb107e2a609c8
sillytavern = 47b656260595967ad70b749845f7b5b33ed3631c
sillytavern_extras = 1d82f3a8607319d1e09a2f4749a09c564c18c320
text_generation_webui = ad122361ea1dbc4b419214891b83f6b9ac12f947
vllm = a395a638c2f18d549e7d01655cf7a6dbee566f91

4 changes: 0 additions & 4 deletions .ci/template/gh-build-iso.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
{% if type != "empty" %}
with:
submodules: recursive
{% endif %}

- name: Build image
uses: addnab/docker-run-action@v3
Expand Down
38 changes: 27 additions & 11 deletions .ci/template/sh-build-iso.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
branches:
- main

pull_request:
branches:
- main

jobs:
vm-start:
if: always()
Expand All @@ -34,6 +30,33 @@ jobs:
# Fix permissions for private key
chmod 600 /tmp/private.key

- name: Wait {{ delay }} seconds
run: |
sleep {{ delay }}

- name: Wait until Github Actions Runner VM is stopped
run: |
ok="0"

while true; do
status=$(ssh runner "virsh domstate GithubActions")

if [ "$status" = "shutoff" ]; then
if [ "$ok" = "1" ]; then
echo "VM is shut off. Exiting."
break
else
sleep $((10 + $RANDOM % 10))
ok="1"
fi
else
ok="0"
fi

echo "VM is not shut off yet. Waiting for 5 seconds..."
sleep 5
done

- name: Start Github Actions Runner VM
run: |
ssh runner "virsh start GithubActions"
Expand All @@ -49,10 +72,6 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
{% if type != "empty" %}
with:
submodules: recursive
{% endif %}

- name: Build image
uses: addnab/docker-run-action@v3
Expand Down Expand Up @@ -131,6 +150,3 @@ jobs:

# Wait 2 minutes
sleep 120

# Force terminate if needed
ssh runner "virsh destroy GithubActions" || true
43 changes: 43 additions & 0 deletions .ci/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3

import configparser
import requests

def fetch_latest_revision(url):
# github
if url.startswith("https://github.com/") and url.endswith(".git"):
# extract repo path
path = url[19:-4]

# get commits from api
response = requests.get(f"https://api.github.com/repos/{path}/commits")

# throw error if not success
response.raise_for_status()

# parse json
data = response.json()

# return first commit id
return data[0]["sha"]

raise ValueError(f"Unsupported: {url}")

def main():
# load options
config = configparser.ConfigParser()
config.read(".ci/options.ini")

# default option value
config["revisions"] = {}

# iterate over repositories
for key, value in config.items("repositories"):
config["revisions"][key] = fetch_latest_revision(value)

# write config back
with open(".ci/options.ini", "w") as file:
config.write(file)

if __name__ == "__main__":
main()
63 changes: 63 additions & 0 deletions .github/workflows/gh-build-iso-cuda-gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build ISO on hosted runner (CUDA, gui)

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main
with:
retain: "docker_buildkit,docker_imgcache"

- name: Checkout repository
uses: actions/checkout@v4

- name: Build image
uses: addnab/docker-run-action@v3
with:
image: archlinux:latest

options: --privileged --volume ${{ github.workspace }}:/workspace
run: |
# Exit on error
set -eu
# Enter project directory
pushd /workspace
# Install dependencies
.ci/dependencies.sh
# Patch mkarchiso
.ci/mkarchiso.sh
# Configure to use CUDA
.ci/configure.py cuda gui
popd
# Build image
mkarchiso -v -m iso -w /_work -o /workspace/out /workspace
- name: Create summary
run: |
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: archiso-output
path: out/
2 changes: 0 additions & 2 deletions .github/workflows/gh-build-iso-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build image
uses: addnab/docker-run-action@v3
Expand Down
Loading

0 comments on commit f5eb989

Please sign in to comment.