Skip to content

Commit

Permalink
Change CI, fix vLLM on Pascal (#33)
Browse files Browse the repository at this point in the history
* Use GH runner for rocm

* Update repositories

* Install custom triton with pascal support for vllm

* Dedupe after each repo on rocm

* Install triton before dependencies

* Update .gitignore

* Use subdirectory for triton installation

* Replace nodm with ly, add power options to openbox

* Use latest release instead of latest commit on default branch for some projects

* Add update repositories script

* Reenable rocm on selfhosted, but manual only

* Change summary generation

* Remove triton & npm cache

* Increase cowspace
  • Loading branch information
sasha0552 authored Apr 25, 2024
1 parent f5eb989 commit ee4d935
Show file tree
Hide file tree
Showing 23 changed files with 203 additions and 235 deletions.
4 changes: 2 additions & 2 deletions .ci/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def main():
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}/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}/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-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)
render_template(f"{i}/sh-build-iso.yml.jinja2", f"{o}/sh-build-iso-rocm-gui.yml" , platform="rocm", type="gui")

if __name__ == "__main__":
main()
20 changes: 14 additions & 6 deletions .ci/options.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ vllm = https://github.com/vllm-project/vllm.git

[revisions]
automatic = de267390905335d353deab3e9ac2031432f4d305
axolotl = 68601ec6ad1cc0e8cb855376586e6eef6a8aa270
axolotl = v0.4.0
comfyui = 8dc19e40d129c8ee049be7be2657458509717ba5
koboldcpp = 593f08bb78ab6035f91cc7aa753975254f30ed82
llamacpp = 784e11dea1f5ce9638851b2b0dddb107e2a609c8
sillytavern = 47b656260595967ad70b749845f7b5b33ed3631c
koboldcpp = v1.63
llamacpp = b2724
sillytavern = 1.11.8
sillytavern_extras = 1d82f3a8607319d1e09a2f4749a09c564c18c320
text_generation_webui = ad122361ea1dbc4b419214891b83f6b9ac12f947
vllm = a395a638c2f18d549e7d01655cf7a6dbee566f91
text_generation_webui = snapshot-2024-04-21
vllm = v0.4.1

[strategy]
axolotl = release
koboldcpp = release
llamacpp = release
sillytavern = release
text_generation_webui = release
vllm = release

10 changes: 8 additions & 2 deletions .ci/template/gh-build-iso.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ jobs:
# Exit on error
set -eu

# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"

# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"

# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
44 changes: 12 additions & 32 deletions .ci/template/sh-build-iso.yml.jinja2
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build ISO on selfhosted runner ({{ "CUDA" if type == "cuda" else "ROCm" }}, {{ type }})

on:
push:
branches:
- main
workflow_dispatch:

jobs:
vm-start:
Expand All @@ -30,33 +28,6 @@ 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 Down Expand Up @@ -109,8 +80,14 @@ jobs:
# Exit on error
set -eu

# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"

# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"

# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -150,3 +127,6 @@ jobs:

# Wait 2 minutes
sleep 120

# Forcefully stop VM if needed
ssh runner "virsh destroy GithubActions" || true
55 changes: 43 additions & 12 deletions .ci/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,68 @@
import configparser
import requests

def fetch_latest_revision(url):
def fetch_latest_revision(url, strategy):
# 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")
match strategy:
case "commit":
# get commits from api
response = requests.get(f"https://api.github.com/repos/{path}/commits")

# throw error if not success
response.raise_for_status()
# throw error if not success
response.raise_for_status()

# parse json
data = response.json()
# parse json
data = response.json()

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

raise ValueError(f"Unsupported: {url}")
case "release":
# get releases from api
response = requests.get(f"https://api.github.com/repos/{path}/releases")

# throw error if not success
response.raise_for_status()

# parse json
data = response.json()

# find first release
for release in data:
if not release["prerelease"]:
return release["tag_name"]

raise ValueError(f"Unsupported url or strategy ({url}, {strategy})")

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

# default option value
config["revisions"] = {}
if "revisions" not in config:
config["revisions"] = {}

# default option value
if "strategy" not in config:
config["strategy"] = {}

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

# extract strategy
if key in config["strategy"]:
strategy = config["strategy"][key]

# if not locked, update
if strategy != "locked":
config["revisions"][key] = fetch_latest_revision(value, strategy)

# write config back
with open(".ci/options.ini", "w") as file:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/gh-build-iso-cuda-empty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ jobs:
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"
# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"
# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/gh-build-iso-cuda-gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ jobs:
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"
# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"
# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/gh-build-iso-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ jobs:
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"
# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"
# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/gh-build-iso-rocm-empty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ jobs:
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"
# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"
# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/gh-update-repositories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update repositories

on:
schedule:
- cron: "0 0 * * 0"

workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest

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

- name: Update repositories
run: .ci/update.py

- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
branch: update-repositories/patch
commit-message: Update repositories
title: Update repositories
46 changes: 13 additions & 33 deletions .github/workflows/sh-build-iso-rocm-gui.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build ISO on selfhosted runner (ROCm, gui)

on:
push:
branches:
- main
workflow_dispatch:

jobs:
vm-start:
Expand All @@ -29,33 +27,6 @@ jobs:
# Fix permissions for private key
chmod 600 /tmp/private.key
- name: Wait 30 seconds
run: |
sleep 30
- 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 Down Expand Up @@ -103,8 +74,14 @@ jobs:
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
# Start code section
echo '`' > "$GITHUB_STEP_SUMMARY"
# Print checksums
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY"
# End code section
echo '`' >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -142,4 +119,7 @@ jobs:
ssh runner "virsh shutdown GithubActions"
# Wait 2 minutes
sleep 120
sleep 120
# Forcefully stop VM if needed
ssh runner "virsh destroy GithubActions" || true
Loading

0 comments on commit ee4d935

Please sign in to comment.