-
Notifications
You must be signed in to change notification settings - Fork 31
93 lines (75 loc) · 2.61 KB
/
test-finetune.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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