Skip to content

Commit 1e973a3

Browse files
robertobarredaclauderuizhang0101
authored
[Feat][Helm] Add vllmConfig.revision for HuggingFace model version pinning (#961)
* [Feat][Helm] Add vllmConfig.revision for HuggingFace model version pinning Add a `revision` field to `vllmConfig` that maps to vLLM's `--revision` flag, allowing operators to pin deployed models to a specific HuggingFace Hub branch, tag, or commit hash. Without this, vLLM always pulls the latest commit on the default branch, which can silently change model behaviour across re-deploys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Roberto Barreda <roberto.barreda@midokura.com> * [Feat][Helm] fix pre-commit checks Signed-off-by: Roberto Barreda <roberto.barreda@midokura.com> * feat(helm): promote modelRevision to top-level model spec field Move revision pinning from vllmConfig.revision to modelRevision at the model spec level, making it a first-class field on each model entry. - Add modelRevision to modelSpec defaults and schema - Update deployment-vllm-multi and ray-cluster templates to read $modelSpec.modelRevision - Update tests to use modelRevision instead of vllmConfig.revision - Update docs to reference modelRevision - Add llama3 example entry to values-01 with pinned revision modelRevision for meta-llama/Llama-3.1-8B-Instruct obtained via: curl -s https://huggingface.co/api/models/meta-llama/Llama-3.1-8B-Instruct | yq -p json '.sha' Signed-off-by: Roberto Barreda <roberto.barreda@midokura.com> --------- Signed-off-by: Roberto Barreda <roberto.barreda@midokura.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Rui Zhang <51696593+ruizhang0101@users.noreply.github.com>
1 parent 5261497 commit 1e973a3

7 files changed

Lines changed: 124 additions & 0 deletions

File tree

docs/source/deployment/helm.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Explanation of Key Items in ``values-02-basic-config.yaml``
4545
- ``maxModelLen``: The maximum sequence length the model can handle.
4646
- ``dtype``: Data type for computations, e.g., ``bfloat16`` for faster performance on modern GPUs.
4747
- ``extraArgs``: Additional arguments passed to the vLLM engine for fine-tuning behavior.
48+
- ``modelRevision``: Hugging Face model revision (branch, tag, or commit hash) to pin the exact model version downloaded at deployment time.
4849

4950
- **hf_token**: The Hugging Face token for authenticating with the Hugging Face model hub.
5051
- **env**: Extra environment variables to pass to the model-serving engine.

helm/templates/deployment-vllm-multi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ spec:
197197
{{- end }}
198198
{{- end }}
199199
{{- end }}
200+
{{- if $modelSpec.modelRevision }}
201+
- "--revision"
202+
- {{ $modelSpec.modelRevision | quote }}
203+
{{- end }}
200204
{{- if $modelSpec.lmcacheConfig }}
201205
{{- if $modelSpec.lmcacheConfig.enabled }}
202206
{{- if hasKey $modelSpec.lmcacheConfig "enablePD" }}

helm/templates/ray-cluster.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ data:
635635
ARGS+=({{ . | quote }})
636636
{{- end }}
637637
{{- end }}
638+
{{- if $modelSpec.modelRevision }}
639+
ARGS+=("--revision" {{ $modelSpec.modelRevision | quote }})
640+
{{- end }}
638641
639642
{{- if $modelSpec.lmcacheConfig }}
640643
{{- if $modelSpec.lmcacheConfig.enabled }}

helm/tests/deployment-vllm-multi_test.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,53 @@ tests:
363363
value: "localhost"
364364
- name: LMCACHE_P2P_INIT_PORTS
365365
value: "30081"
366+
367+
- it: should pass --revision flag when modelRevision is set
368+
release:
369+
name: vllm
370+
set:
371+
servingEngineSpec:
372+
enableEngine: true
373+
modelSpec:
374+
- name: "opt125m"
375+
repository: "lmcache/vllm-openai"
376+
tag: "latest"
377+
modelURL: "facebook/opt-125m"
378+
replicaCount: 1
379+
requestCPU: 6
380+
requestMemory: "16Gi"
381+
requestGPU: 1
382+
pvcStorage: "50Gi"
383+
modelRevision: "abc123def"
384+
asserts:
385+
- documentIndex: 0
386+
contains:
387+
path: spec.template.spec.containers[0].command
388+
content: "--revision"
389+
- documentIndex: 0
390+
contains:
391+
path: spec.template.spec.containers[0].command
392+
content: "abc123def"
393+
394+
- it: should not pass --revision flag when modelRevision is empty
395+
release:
396+
name: vllm
397+
set:
398+
servingEngineSpec:
399+
enableEngine: true
400+
modelSpec:
401+
- name: "opt125m"
402+
repository: "lmcache/vllm-openai"
403+
tag: "latest"
404+
modelURL: "facebook/opt-125m"
405+
replicaCount: 1
406+
requestCPU: 6
407+
requestMemory: "16Gi"
408+
requestGPU: 1
409+
pvcStorage: "50Gi"
410+
modelRevision: ""
411+
asserts:
412+
- documentIndex: 0
413+
notContains:
414+
path: spec.template.spec.containers[0].command
415+
content: "--revision"

helm/tests/ray-cluster_test.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,3 +603,63 @@ tests:
603603
- documentIndex: 0
604604
isNull:
605605
path: spec.workerGroupSpecs[0].template.spec.serviceAccountName
606+
607+
- it: should pass --revision flag in the start script when modelRevision is set
608+
release:
609+
name: vllm
610+
set:
611+
servingEngineSpec:
612+
enableEngine: true
613+
modelSpec:
614+
- name: "test-model"
615+
repository: "vllm/vllm-openai"
616+
tag: "latest"
617+
modelURL: "facebook/opt-125m"
618+
replicaCount: 1
619+
requestCPU: 1
620+
requestMemory: "1Gi"
621+
requestGPU: 1
622+
raySpec:
623+
enabled: true
624+
headNode:
625+
requestCPU: 1
626+
requestMemory: "1Gi"
627+
requestGPU: 1
628+
modelRevision: "abc123def"
629+
asserts:
630+
- documentSelector:
631+
path: metadata.name
632+
value: "test-model-vllm-start-script"
633+
matchRegex:
634+
path: data["vllm-entrypoint.sh"]
635+
pattern: "--revision.*abc123def"
636+
637+
- it: should not pass --revision flag in the start script when modelRevision is empty
638+
release:
639+
name: vllm
640+
set:
641+
servingEngineSpec:
642+
enableEngine: true
643+
modelSpec:
644+
- name: "test-model"
645+
repository: "vllm/vllm-openai"
646+
tag: "latest"
647+
modelURL: "facebook/opt-125m"
648+
replicaCount: 1
649+
requestCPU: 1
650+
requestMemory: "1Gi"
651+
requestGPU: 1
652+
raySpec:
653+
enabled: true
654+
headNode:
655+
requestCPU: 1
656+
requestMemory: "1Gi"
657+
requestGPU: 1
658+
modelRevision: ""
659+
asserts:
660+
- documentSelector:
661+
path: metadata.name
662+
value: "test-model-vllm-start-script"
663+
notMatchRegex:
664+
path: data["vllm-entrypoint.sh"]
665+
pattern: "--revision"

helm/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,10 @@
13771377
}
13781378
}
13791379
},
1380+
"modelRevision": {
1381+
"description": "Hugging Face model revision (branch, tag, or commit hash) to pin the model version",
1382+
"type": "string"
1383+
},
13801384
"modelURL": {
13811385
"description": "The URL of the model",
13821386
"type": "string"

helm/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ servingEngineSpec:
4949
imagePullSecret: ""
5050
# -- The URL of the model
5151
modelURL: "mistralai/Mistral-7B-Instruct-v0.2"
52+
# -- Hugging Face model revision (branch, tag, or commit hash) to pin the model version
53+
modelRevision: ""
5254
# -- Chat template (Jinga2) specifying tokenizer configuration
5355
# chatTemplate: "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ 'Question:\n' + message['content'] + '\n\n' }}{% elif message['role'] == 'system' %}\n{{ 'System:\n' + message['content'] + '\n\n' }}{% elif message['role'] == 'assistant' %}{{ 'Answer:\n' + message['content'] + '\n\n' }}{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ 'Answer:\n' }}{% endif %}{% endfor %}"
5456
# -- The number of replicas for the model

0 commit comments

Comments
 (0)