devzone 0.56.0 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Presets of the local model (#586), sourced by llm.sh and argocd/services-hook.sh.
3
- # The values are the ones documented in charts/devzone-llm/values.yaml: the
4
- # Hugging Face URL is pinned to a commit (resolve/<commit>) and the sha256 is
5
- # the one of the file, checked by the init container of the chart.
6
- # llm_preset_name <name> canonical preset (default | light), 1 when unknown
7
- # llm_preset_sets <name> helm parameters key=value, space separated
8
- # llm_preset_file <name> file name of the model of the preset
9
- # bash 3.2 (macOS).
10
-
11
- LLM_HF_7B="https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/13fb94bfda8c8cf22497dc57b78f391a9acb426a"
12
- LLM_HF_3B="https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct-GGUF/resolve/f74adce6aa16316c625447af059dbebe4983757c"
13
-
14
- llm_preset_name() {
15
- case "${1:-}" in
16
- "" | default | qwen2.5-coder-7b-instruct-q4_k_m) echo default ;;
17
- light | qwen2.5-coder-3b-instruct-q4_k_m) echo light ;;
18
- *) return 1 ;;
19
- esac
20
- }
21
-
22
- llm_preset_file() {
23
- case "$(llm_preset_name "${1:-}")" in
24
- default) echo qwen2.5-coder-7b-instruct-q4_k_m.gguf ;;
25
- light) echo qwen2.5-coder-3b-instruct-q4_k_m.gguf ;;
26
- esac
27
- }
28
-
29
- llm_preset_sets() {
30
- local name file
31
- name="$(llm_preset_name "${1:-}")" || return 1
32
- file="$(llm_preset_file "$name")"
33
- case "$name" in
34
- default)
35
- printf 'model.url=%s/%s model.file=%s model.sha256=%s' "$LLM_HF_7B" "$file" "$file" \
36
- 509287f78cb4d4cf6b3843734733b914b2c158e43e22a7f4bf5e963800894d3c
37
- ;;
38
- light)
39
- printf 'model.url=%s/%s model.file=%s model.sha256=%s memory=3Gi resources.limits.memory=4Gi contextSize=16384' \
40
- "$LLM_HF_3B" "$file" "$file" 724fb256bec1ff062b2f65e4569e871ad2e95ab2a3989723d1769c54294730b7
41
- ;;
42
- esac
43
- }
@@ -1,6 +0,0 @@
1
- apiVersion: v2
2
- name: devzone-llm
3
- description: Local code model of devzone, llama.cpp llama-server on CPU with a GGUF model on a volume (#586)
4
- type: application
5
- version: 0.1.0
6
- appVersion: "b12407"
@@ -1,65 +0,0 @@
1
- {{- if .Values.bench.enabled }}
2
- # One-off llama-bench of the model (#593), never rendered by default. The
3
- # volume is ReadWriteOnce: the pod must land on the node of the server pod.
4
- apiVersion: batch/v1
5
- kind: Job
6
- metadata:
7
- name: llm-bench
8
- namespace: {{ .Release.Namespace }}
9
- labels:
10
- app: llm-bench
11
- app.kubernetes.io/name: llm-bench
12
- app.kubernetes.io/part-of: devzone
13
- app.kubernetes.io/managed-by: devzone
14
- spec:
15
- backoffLimit: 0
16
- activeDeadlineSeconds: {{ .Values.bench.deadline }}
17
- ttlSecondsAfterFinished: {{ .Values.bench.ttl }}
18
- template:
19
- metadata:
20
- labels:
21
- app: llm-bench
22
- app.kubernetes.io/managed-by: devzone
23
- spec:
24
- restartPolicy: Never
25
- affinity:
26
- podAffinity:
27
- requiredDuringSchedulingIgnoredDuringExecution:
28
- - topologyKey: kubernetes.io/hostname
29
- labelSelector:
30
- matchLabels:
31
- app: llm
32
- containers:
33
- - name: bench
34
- image: {{ .Values.image }}:full-{{ .Values.llamaBuild }}
35
- command:
36
- - /app/llama-bench
37
- args:
38
- - -m
39
- - /models/{{ .Values.model.file }}
40
- - -p
41
- - {{ .Values.bench.prompt | quote }}
42
- - -n
43
- - {{ .Values.bench.gen | quote }}
44
- - -r
45
- - {{ .Values.bench.repetitions | quote }}
46
- - -t
47
- - {{ .Values.bench.threads | quote }}
48
- - -o
49
- - json
50
- resources:
51
- requests:
52
- cpu: {{ .Values.resources.requests.cpu }}
53
- memory: {{ .Values.memory }}
54
- limits:
55
- memory: {{ .Values.resources.limits.memory }}
56
- volumeMounts:
57
- - name: models
58
- mountPath: /models
59
- readOnly: true
60
- volumes:
61
- - name: models
62
- persistentVolumeClaim:
63
- claimName: {{ .Values.claim }}
64
- readOnly: true
65
- {{- end }}
@@ -1,113 +0,0 @@
1
- apiVersion: apps/v1
2
- kind: Deployment
3
- metadata:
4
- name: llm
5
- namespace: {{ .Release.Namespace }}
6
- labels:
7
- app: llm
8
- app.kubernetes.io/name: llm
9
- app.kubernetes.io/part-of: devzone
10
- app.kubernetes.io/managed-by: devzone
11
- spec:
12
- replicas: 1
13
- strategy:
14
- type: Recreate
15
- selector:
16
- matchLabels:
17
- app: llm
18
- template:
19
- metadata:
20
- labels:
21
- app: llm
22
- app.kubernetes.io/managed-by: devzone
23
- spec:
24
- initContainers:
25
- - name: fetch-model
26
- image: {{ .Values.fetchImage }}
27
- securityContext:
28
- runAsUser: 0
29
- env:
30
- - name: MODEL_URL
31
- value: {{ .Values.model.url | quote }}
32
- - name: MODEL_FILE
33
- value: {{ .Values.model.file | quote }}
34
- - name: MODEL_SHA256
35
- value: {{ .Values.model.sha256 | quote }}
36
- command:
37
- - sh
38
- - -c
39
- - |
40
- set -eu
41
- f="/models/$MODEL_FILE"
42
- if [ ! -f "$f" ]; then
43
- echo "downloading $MODEL_FILE (first start: several minutes)"
44
- curl -fL --retry 5 --retry-delay 5 -C - -o "$f.part" "$MODEL_URL"
45
- mv "$f.part" "$f"
46
- fi
47
- if ! echo "$MODEL_SHA256 $f" | sha256sum -c -; then
48
- echo "sha256 differs: $MODEL_FILE removed" >&2
49
- rm -f "$f"
50
- exit 1
51
- fi
52
- volumeMounts:
53
- - name: models
54
- mountPath: /models
55
- containers:
56
- - name: llm
57
- image: {{ .Values.image }}:server-{{ .Values.llamaBuild }}
58
- env:
59
- - name: THREADS
60
- value: {{ .Values.threads | quote }}
61
- - name: MAX_THREADS
62
- value: {{ .Values.maxThreads | quote }}
63
- command:
64
- - sh
65
- - -c
66
- - |
67
- set -eu
68
- t="$THREADS"
69
- if [ "$t" = auto ]; then
70
- t="$(nproc)"
71
- [ "$t" -le "$MAX_THREADS" ] || t="$MAX_THREADS"
72
- fi
73
- echo "llama-server: $t threads"
74
- exec /app/llama-server "$@" -t "$t" --threads-batch "$t"
75
- - llama-server
76
- args:
77
- - --host
78
- - 0.0.0.0
79
- - --port
80
- - "8080"
81
- - -m
82
- - /models/{{ .Values.model.file }}
83
- - -c
84
- - {{ .Values.contextSize | quote }}
85
- - --cache-type-k
86
- - {{ .Values.cacheType | quote }}
87
- - --cache-type-v
88
- - {{ .Values.cacheType | quote }}
89
- - --flash-attn
90
- - {{ .Values.flashAttention | quote }}
91
- ports:
92
- - containerPort: 8080
93
- name: http
94
- readinessProbe:
95
- httpGet:
96
- path: /health
97
- port: 8080
98
- initialDelaySeconds: 10
99
- periodSeconds: 10
100
- failureThreshold: 30
101
- resources:
102
- requests:
103
- cpu: {{ .Values.resources.requests.cpu }}
104
- memory: {{ .Values.memory }}
105
- limits:
106
- memory: {{ .Values.resources.limits.memory }}
107
- volumeMounts:
108
- - name: models
109
- mountPath: /models
110
- volumes:
111
- - name: models
112
- persistentVolumeClaim:
113
- claimName: {{ .Values.claim }}
@@ -1,19 +0,0 @@
1
- apiVersion: v1
2
- kind: PersistentVolumeClaim
3
- metadata:
4
- name: {{ .Values.claim }}
5
- namespace: {{ .Release.Namespace }}
6
- labels:
7
- app: llm
8
- app.kubernetes.io/name: llm
9
- app.kubernetes.io/part-of: devzone
10
- app.kubernetes.io/managed-by: devzone
11
- annotations:
12
- # The model is not downloaded again: the volume outlives the release
13
- helm.sh/resource-policy: keep
14
- argocd.argoproj.io/sync-options: Delete=false
15
- spec:
16
- accessModes: ["ReadWriteOnce"]
17
- resources:
18
- requests:
19
- storage: {{ .Values.size }}
@@ -1,18 +0,0 @@
1
- apiVersion: v1
2
- kind: Service
3
- metadata:
4
- name: llm
5
- namespace: {{ .Release.Namespace }}
6
- labels:
7
- app: llm
8
- app.kubernetes.io/name: llm
9
- app.kubernetes.io/part-of: devzone
10
- app.kubernetes.io/managed-by: devzone
11
- spec:
12
- type: ClusterIP
13
- selector:
14
- app: llm
15
- ports:
16
- - name: http
17
- port: {{ .Values.port }}
18
- targetPort: 8080
@@ -1,72 +0,0 @@
1
- # The one definition of the local model: the helm-direct path installs this
2
- # chart (.devcontainer/llm/llm.sh) as the release llm. No Secret: the model is
3
- # public and checked by its sha256.
4
- # Official llama.cpp image repository (CPU). The tag is derived from llamaBuild:
5
- # server-<llamaBuild> runs the model, full-<llamaBuild> (llama-bench, only for
6
- # the bench Job) comes from the same build.
7
- image: ghcr.io/ggml-org/llama.cpp
8
- # The one pinned llama.cpp build, shared by the server and the bench images
9
- llamaBuild: b12407
10
- # Image of the init container that downloads and checks the model
11
- fetchImage: curlimages/curl:8.11.1
12
- # Port of the Service and of llama-server
13
- port: 8080
14
- # Memory request of the container (the limit is resources.limits.memory)
15
- memory: 6Gi
16
- # Name of the volume claim holding the models; kept when the release goes
17
- claim: llm-models
18
- # Size of the models volume
19
- size: 8Gi
20
- # Context size (-c) of llama-server. 32768 is the native window of Qwen2.5; the
21
- # light preset uses 16384 (--set contextSize=16384).
22
- contextSize: 32768
23
- # KV cache type for K and V (--cache-type-k / --cache-type-v): q8_0 costs about
24
- # 1 GB at 32k for the 7B (f16 about 1.9 GB). A quantized V cache needs flash
25
- # attention.
26
- cacheType: q8_0
27
- # Flash attention (--flash-attn on|off|auto in server-b12407)
28
- flashAttention: "on"
29
- # Threads (-t and --threads-batch): auto = the CPUs seen by the container
30
- # (nproc), capped by maxThreads; a number is used as is.
31
- threads: auto
32
- maxThreads: 8
33
- # The model: downloaded only when the file is missing, then its sha256 is
34
- # checked (the file is removed and the pod fails when it differs). The URL is
35
- # pinned to a Hugging Face commit (resolve/<commit>).
36
- # Preset "qwen2.5-coder-7b-instruct-q4_k_m" (default, 4.7 GB):
37
- # url: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/13fb94bfda8c8cf22497dc57b78f391a9acb426a/qwen2.5-coder-7b-instruct-q4_k_m.gguf
38
- # file: qwen2.5-coder-7b-instruct-q4_k_m.gguf
39
- # sha256: 509287f78cb4d4cf6b3843734733b914b2c158e43e22a7f4bf5e963800894d3c
40
- # Preset "qwen2.5-coder-3b-instruct-q4_k_m" (light, 2.1 GB; memory=3Gi,
41
- # resources.limits.memory=4Gi and contextSize=16384):
42
- # url: https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct-GGUF/resolve/f74adce6aa16316c625447af059dbebe4983757c/qwen2.5-coder-3b-instruct-q4_k_m.gguf
43
- # file: qwen2.5-coder-3b-instruct-q4_k_m.gguf
44
- # sha256: 724fb256bec1ff062b2f65e4569e871ad2e95ab2a3989723d1769c54294730b7
45
- model:
46
- url: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/13fb94bfda8c8cf22497dc57b78f391a9acb426a/qwen2.5-coder-7b-instruct-q4_k_m.gguf
47
- file: qwen2.5-coder-7b-instruct-q4_k_m.gguf
48
- sha256: 509287f78cb4d4cf6b3843734733b914b2c158e43e22a7f4bf5e963800894d3c
49
- # CPU: a request only (no CPU limit, so the threads are not throttled)
50
- resources:
51
- requests:
52
- cpu: "2"
53
- limits:
54
- memory: 7Gi
55
- # llama-bench Job (templates/bench-job.yaml), rendered only when enabled=true,
56
- # which `devzone llm bench` sets. It runs the image full-<llamaBuild> (larger
57
- # than the server image, pulled only for the bench) on the node of the server
58
- # pod, with the models volume read-only, and is removed after ttl seconds.
59
- bench:
60
- enabled: false
61
- # Prompt tokens (-p), generated tokens (-n), repetitions of each test (-r;
62
- # llama-bench defaults to 5) and the thread counts tried (-t). Small values:
63
- # the whole bench takes a few minutes, even on a slow machine.
64
- prompt: 128
65
- gen: 32
66
- repetitions: 1
67
- threads: "4,8"
68
- # Seconds before the finished Job is garbage collected
69
- ttl: 600
70
- # Seconds before a stuck Job is stopped (activeDeadlineSeconds: the Job does
71
- # not run forever if the call that started it is interrupted)
72
- deadline: 1800