Skip to content

Commit

Permalink
shm mount
Browse files Browse the repository at this point in the history
  • Loading branch information
arti-shalb committed Nov 8, 2023
1 parent 008ef72 commit 0274849
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion huggingface-model/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: Helm chart for deploy Hugging Face to kubernetes cluster. See [Hugg

type: application

version: 0.0.20
version: 0.0.21

2 changes: 2 additions & 0 deletions huggingface-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ See [Hugging Face models](https://huggingface.co/models)
| `imagePullSecrets` | May need if used private repo as a cache for image ghcr.io/huggingface/text-generation-inference | `[]` |
| `nameOverride` | String to partially override common.names.name | `""` |
| `fullnameOverride` | String to fully override common.names.fullname | `""` |
| `shmVolume.enabled` | Enable emptyDir volume for /dev/shm for model pod(s) | `true` |
| `shmVolume.sizeLimit` | Set this to enable a size limit on the shm tmpfs | `1Gi` |
| `persistence.accessModes` | PVC accessModes | `["ReadWriteOnce"]` |
| `persistence.storageClassName` | Kubernetes storageClass name | `gp2` |
| `persistence.storage` | Volume size | `100Gi` |
Expand Down
14 changes: 12 additions & 2 deletions huggingface-model/templates/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ spec:
volumeMounts:
- name: model-storage
mountPath: "/usr/src/{{ .Values.model.name }}"
{{- with .Values.extraVolumeMounts}}
{{- if .Values.shmVolume.enabled }}
- name: shm
mountPath: /dev/shm
{{- end }}
{{- with .Values.extraVolumeMounts}}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand All @@ -132,6 +136,12 @@ spec:
- name: model-storage
persistentVolumeClaim:
claimName: {{ include "huggingface-model.fullname" . }}
{{- if .Values.shmVolume.enabled }}
- name: shm
emptyDir:
medium: Memory
sizeLimit: {{ default "1Gi" .Values.shmVolume.sizeLimit }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
13 changes: 13 additions & 0 deletions huggingface-model/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ nameOverride: ""
##
fullnameOverride: ""

## Start model pod(s) without limitations on shm memory.
## By default docker and containerd (and possibly other container runtimes) limit `/dev/shm` to `64M`
## ref: https://github.com/containerd/containerd/issues/3654
##
shmVolume:
## @param shmVolume.enabled Enable emptyDir volume for /dev/shm for model pod(s)
##
enabled: true
## @param shmVolume.sizeLimit Set this to enable a size limit on the shm tmpfs
## Note: the size of the tmpfs counts against container's memory limit
##
sizeLimit: "1Gi"

## Persistence parameters
## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
## @param persistence.accessModes PVC accessModes
Expand Down

0 comments on commit 0274849

Please sign in to comment.