Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix model-downloader and tgi in multi shard case #642

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions helm-charts/common/speecht5/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ spec:
- configMapRef:
name: {{ include "speecht5.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing "pip install" on every container start is not a fix, at best it's a (rather horrible) temporary band-aid...

Isn't there any HF image which would have a working huggingface-hub version?

If not, this issue should be reported to upstream. And "TODO: fix this for 1.2 release" comment here with a link to the ticket would be good.

=> If upstream does not provide fixed image before OPEA 1.2 release, I think OPEA needs to add such image to DockerHub before next release...

Copy link
Collaborator Author

@lianhao lianhao Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's a temporary workaround to unblock the CI. Created an issue in upstream huggingface/huggingface_hub#2708

allowPrivilegeEscalation: false
{{- if hasKey .Values.securityContext "runAsGroup" }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{- end }}
Expand All @@ -51,16 +51,24 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) {{ .Values.TTS_MODEL_PATH | quote }};
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) {{ .Values.VOCODER_MODEL| quote }};
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download models {{ .Values.TTS_MODEL_PATH }} {{ .Values.VOCODER_MODEL }} ... ";
huggingface-cli download --cache-dir /data {{ .Values.TTS_MODEL_PATH | quote }};
huggingface-cli download --cache-dir /data {{ .Values.VOCODER_MODEL| quote }};
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.TTS_MODEL_PATH }};
chmod -R g+w /data/models--{{ replace "/" "--" .Values.VOCODER_MODEL }}
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Release.Name }}
Expand Down
14 changes: 11 additions & 3 deletions helm-charts/common/tei/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ spec:
- configMapRef:
name: {{ include "tei.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
{{- if hasKey .Values.securityContext "runAsGroup" }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{- end }}
Expand All @@ -54,14 +54,22 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) $(MODEL_ID);
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download model $(MODEL_ID) ... ";
huggingface-cli download --cache-dir /data $(MODEL_ID);
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.EMBEDDING_MODEL_ID }}
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
14 changes: 11 additions & 3 deletions helm-charts/common/teirerank/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ spec:
- configMapRef:
name: {{ include "teirerank.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
{{- if hasKey .Values.securityContext "runAsGroup" }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{- end }}
Expand All @@ -54,14 +54,22 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) $(MODEL_ID);
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download model $(MODEL_ID) ... ";
huggingface-cli download --cache-dir /data $(MODEL_ID);
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.RERANK_MODEL_ID }}
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/tgi/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ data:
no_proxy: {{ .Values.global.no_proxy | quote }}
{{- if contains "tgi-gaudi" .Values.image.repository }}
HABANA_LOGS: "/tmp/habana_logs"
TRITON_CACHE_DIR: "/tmp/triton_cache"
{{- end }}
NUMBA_CACHE_DIR: "/tmp"
HF_HOME: "/tmp/.cache/huggingface"
Expand Down
20 changes: 16 additions & 4 deletions helm-charts/common/tgi/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ spec:
- configMapRef:
name: {{ include "tgi.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
{{- if hasKey .Values.securityContext "runAsGroup" }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{- end }}
Expand All @@ -54,14 +54,22 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) $(MODEL_ID);
chmod -R g+w /data/models--{{ replace "/" "--" .Values.LLM_MODEL_ID }}
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download model $(MODEL_ID) ... ";
huggingface-cli download --cache-dir /data $(MODEL_ID);
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.LLM_MODEL_ID }};
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -92,6 +100,8 @@ spec:
name: shm
- mountPath: /tmp
name: tmp
- mountPath: /usr/src/out
name: tokenizer
ports:
- name: http
containerPort: {{ .Values.port }}
Expand Down Expand Up @@ -128,6 +138,8 @@ spec:
sizeLimit: {{ .Values.shmSize }}
- name: tmp
emptyDir: {}
- name: tokenizer
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
14 changes: 11 additions & 3 deletions helm-charts/common/vllm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ spec:
- configMapRef:
name: {{ include "vllm.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
Expand All @@ -48,14 +48,22 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) {{ .Values.LLM_MODEL_ID | quote }};
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download model {{ .Values.LLM_MODEL_ID }} ... ";
huggingface-cli download --cache-dir /data {{ .Values.LLM_MODEL_ID | quote }};
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.LLM_MODEL_ID }}
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
14 changes: 11 additions & 3 deletions helm-charts/common/whisper/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ spec:
- configMapRef:
name: {{ include "whisper.fullname" . }}-config
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
{{- if hasKey .Values.securityContext "runAsGroup" }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
{{- end }}
Expand All @@ -51,14 +51,22 @@ spec:
seccompProfile:
type: RuntimeDefault
image: huggingface/downloader:0.17.3
command: ['sh', '-c']
command: ['sh', '-ec']
args:
- |
huggingface-cli download --cache-dir /data --token $(HF_TOKEN) {{ .Values.ASR_MODEL_PATH | quote }};
echo "Huggingface log in ...";
huggingface-cli login --token $(HF_TOKEN);
echo "Download model {{ .Values.ASR_MODEL_PATH }} ... ";
huggingface-cli download --cache-dir /data {{ .Values.ASR_MODEL_PATH | quote }};
echo "Change model files mode ...";
chmod -R g+w /data/models--{{ replace "/" "--" .Values.ASR_MODEL_PATH }}
# NOTE: Buggy logout command;
# huggingface-cli logout;
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
{{- end }}
containers:
- name: {{ .Release.Name }}
Expand Down
Loading