Skip to content

Commit

Permalink
Merge pull request #46 from chnyda/main
Browse files Browse the repository at this point in the history
feat: add new parameter to pass models config files
  • Loading branch information
mudler authored Jul 3, 2024
2 parents d064a61 + 7cea8f0 commit f6d8172
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
11 changes: 11 additions & 0 deletions charts/local-ai/templates/configmap-models-configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.modelsConfigs -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "local-ai.fullname" . }}-models-configs
data:
{{- range $key, $val := .Values.modelsConfigs }}
{{ $key }}: |-
{{ $val | indent 4 }}
{{- end }}
{{- end -}}
28 changes: 28 additions & 0 deletions charts/local-ai/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,31 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.modelsConfigs }}
- name: models-configs
image: {{ .Values.deployment.prompt_templates.image }}
imagePullPolicy: {{ .Values.deployment.pullPolicy }}
command: ["/bin/sh", "-c"]
args:
- |
for file in /models-configs/*; do
filename=$(basename "$file")
if [[ $filename != *.yaml ]]; then
cp -fL "$file" "/models/$filename.yaml"
else
cp -fL "$file" "/models/$filename"
fi
done
volumeMounts:
- mountPath: /models-configs
name: models-configs
{{- range $key, $pvc := $rootPersistence }}
{{- if $pvc.enabled }}
- name: {{ $key }}
mountPath: {{ $pvc.globalMount | default (print "/" $key) }}
{{- end }}
{{- end }}
{{- end }}
- name: download-model
image: {{ .Values.deployment.download_model.image }}
imagePullPolicy: {{ .Values.deployment.pullPolicy }}
Expand Down Expand Up @@ -264,6 +289,9 @@ spec:
- name: prompt-templates
configMap:
name: {{ template "local-ai.fullname" . }}-prompt-templates
- name: models-configs
configMap:
name: {{ template "local-ai.fullname" . }}-models-configs
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
22 changes: 22 additions & 0 deletions charts/local-ai/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ resources:
# cpu: 100m
# memory: 128Mi

# Model config to include
modelsConfigs:
{}
# phi-2: |
# name: phi-2
# context_size: 2048
# f16: true
# mmap: true
# trimsuffix:
# - "\n"
# parameters:
# model: phi-2.Q8_0.gguf
# temperature: 0.2
# top_k: 40
# top_p: 0.95
# seed: -1
# template:
# chat: &template |-
# Instruct: {{.Input}}
# Output:
# completion: *template

# Prompt templates to include
# Note: the keys of this map will be the names of the prompt template files
promptTemplates:
Expand Down

0 comments on commit f6d8172

Please sign in to comment.