fix: bugs for interuption of downloading model
This commit is contained in:
@ -31,19 +31,31 @@ spec:
|
||||
DEST_DIR="{{ .Values.model.localMountPath }}/Weight/$MODEL_NAME"
|
||||
# DEST_DIR="{{ .Values.model.localMountPath }}/{{ .Values.model.huggingfaceName }}"
|
||||
# 检查模型是否存在,不存在则下载
|
||||
echo "DEST_DIR= $DEST_DIR"
|
||||
if [ ! -f "$DEST_DIR/config.json" ]; then
|
||||
ls -l {{ .Values.model.localMountPath }}
|
||||
echo "Downloading model {{ .Values.model.huggingfaceName }} to $DEST_DIR"
|
||||
wget https://hf-mirror.com/hfd/hfd.sh
|
||||
chmod a+x hfd.sh
|
||||
apt update && apt upgrade
|
||||
apt install aria2 -y
|
||||
./hfd.sh {{ .Values.model.huggingfaceName }} --local-dir "$DEST_DIR"
|
||||
# huggingface-cli download {{ .Values.model.huggingfaceName }} --local-dir "$DEST_DIR"
|
||||
else
|
||||
echo "Model already exists at $DEST_DIR"
|
||||
# echo "DEST_DIR= $DEST_DIR"
|
||||
# if [ ! -f "$DEST_DIR/config.json" ]; then
|
||||
# ls -l {{ .Values.model.localMountPath }}
|
||||
# echo "Downloading model {{ .Values.model.huggingfaceName }} to $DEST_DIR"
|
||||
# wget https://hf-mirror.com/hfd/hfd.sh
|
||||
# chmod a+x hfd.sh
|
||||
# apt update && apt upgrade
|
||||
# apt install aria2 -y
|
||||
# ./hfd.sh {{ .Values.model.huggingfaceName }} --local-dir "$DEST_DIR"
|
||||
# # huggingface-cli download {{ .Values.model.huggingfaceName }} --local-dir "$DEST_DIR"
|
||||
# else
|
||||
# echo "Model already exists at $DEST_DIR"
|
||||
# fi
|
||||
SUCCESS_FLAG="${DEST_DIR}/.success_flag"
|
||||
if [ -f "$SUCCESS_FLAG" ]; then
|
||||
echo "✅ Success flag found. Skipping download."
|
||||
exit 0
|
||||
fi
|
||||
echo "⬇️ Starting download..."
|
||||
apk add --no-cache bash aria2 wget ca-certificates
|
||||
wget https://hf-mirror.com/hfd/hfd.sh -O hfd.sh && chmod +x hfd.sh
|
||||
./hfd.sh {{ .Values.model.huggingfaceName }} --tool aria2c -x 8 --local-dir "$DEST_DIR"
|
||||
|
||||
touch "$SUCCESS_FLAG"
|
||||
echo "🎉 Done."
|
||||
volumeMounts:
|
||||
- name: weight-volume
|
||||
mountPath: {{ .Values.model.localMountPath }}
|
||||
@ -94,9 +106,9 @@ spec:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
#httpGet:
|
||||
#path: /health
|
||||
# tcpSocket:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 20
|
||||
@ -190,4 +202,4 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user