docker-test-finetune #80
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker-test-finetune | |
on: | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
test: | |
runs-on: self-hosted | |
timeout-minutes: 360 | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
targets: | |
- unsloth | |
steps: | |
- name: cleanup workspace | |
run: | | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- run: nvidia-smi | |
# use default docker driver builder with containerd image store for local aikit image | |
# must have insecure security entitlement for finetuning | |
# these must be setup before running this test | |
- run: docker buildx use default | |
- name: build aikit | |
run: | | |
docker --debug build . -t aikit:test \ | |
--load --provenance=false --progress plain | |
- name: build finetuned model | |
run: | | |
docker --debug build --allow security.insecure \ | |
--file test/aikitfile-${{ matrix.targets }}.yaml --output _output \ | |
--target ${{ matrix.targets }} --progress plain . | |
- name: check if finetuned model exists | |
run: | | |
ls -al _output | |
test -f _output/model-q4_k_m.gguf | |
- name: build custom model | |
run: | | |
docker --debug build _output --tag custommodel:test \ | |
--file test/aikitfile-${{ matrix.targets }}-custom.yaml \ | |
--load --provenance=false --progress plain | |
- name: list images | |
run: docker images | |
- name: run test model | |
run: docker run --name custommodel -d --rm -p 8080:8080 --gpus all custommodel:test | |
- name: run test | |
run: | | |
result=$(curl --fail --retry 10 --retry-all-errors http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ | |
"model": "custom", | |
"messages": [{"role": "user", "content": "Compose a haiku about cats"}] | |
}') | |
echo $result | |
choices=$(echo "$result" | jq '.choices') | |
if [ -z "$choices" ]; then | |
exit 1 | |
fi | |
- name: save logs | |
if: always() | |
run: docker logs custommodel > /tmp/docker.log | |
- run: docker stop custommodel | |
if: always() | |
- run: docker system prune -a -f --volumes || true | |
if: always() | |
- name: clean up output | |
if: always() | |
run: rm -rf _output | |
- name: publish test artifacts | |
if: always() | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: test | |
path: | | |
/tmp/*.log |