-
Notifications
You must be signed in to change notification settings - Fork 0
Support for multiple LoRAs with multiple models via BBR using convent… #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
5ff3c5c
309637b
ba041ea
37e75ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,9 @@ site | |
|
||
# MacOS generated files | ||
**/.DS_Store | ||
|
||
#archives | ||
*.gz | ||
|
||
#binaries | ||
istioctl |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what YAMLs are used by the current guides? Those are not checked in so you created a new one? Same applies to other YAMLs in this PR |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: routes-to-llms | ||
spec: | ||
parentRefs: | ||
- name: inference-gateway | ||
rules: | ||
- matches: | ||
- headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name | ||
value: 'meta-llama/Llama-3.1-8B-Instruct' | ||
path: | ||
type: PathPrefix | ||
value: / | ||
backendRefs: | ||
- name: vllm-llama3-8b-instruct | ||
group: inference.networking.x-k8s.io | ||
kind: InferencePool | ||
- matches: | ||
- headers: | ||
- type: Exact | ||
name: X-Gateway-Model-Name | ||
value: 'deepseek/deepseek-r1' | ||
path: | ||
type: PathPrefix | ||
value: / | ||
backendRefs: | ||
- name: deepseek-r1 | ||
group: inference.networking.x-k8s.io | ||
kind: InferencePool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing newline at EoF |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: llm-llama-route | ||
spec: | ||
parentRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: inference-gateway | ||
rules: | ||
- backendRefs: | ||
- group: inference.networking.k8s.io | ||
kind: InferencePool | ||
name: vllm-llama3-8b-instruct | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name # (1)! | ||
value: 'meta-llama/Llama-3.1-8B-Instruct' | ||
timeouts: | ||
request: 300s | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: llm-deepseek-route | ||
spec: | ||
parentRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: inference-gateway | ||
rules: | ||
- backendRefs: | ||
- group: inference.networking.k8s.io | ||
kind: InferencePool | ||
name: vllm-deepseek-r1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name | ||
value: 'deepseek/deepseek-r1' | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name | ||
value: 'food-review' | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name | ||
value: 'movie-critique' | ||
timeouts: | ||
request: 300s | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: vllm-llama3-8b-instruct-lora-food-review-1 #give this HTTPRoute any name that helps you to group and track the routes | ||
spec: | ||
parentRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: inference-gateway | ||
rules: | ||
- backendRefs: | ||
- group: inference.networking.k8s.io | ||
kind: InferencePool | ||
name: vllm-llama3-8b-instruct | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
headers: | ||
- type: Exact | ||
#Body-Based routing(https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/pkg/bbr/README.md) is being used to copy the model name from the request body to the header. | ||
name: X-Gateway-Model-Name # (1)! | ||
value: 'food-review-1' #this is the name of LoRA as defined in vLLM deployment | ||
timeouts: | ||
request: 300s |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: vllm-deepseek-r1 | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: vllm-deepseek-r1 | ||
template: | ||
metadata: | ||
labels: | ||
app: vllm-deepseek-r1 | ||
spec: | ||
containers: | ||
- name: vllm-sim | ||
image: ghcr.io/llm-d/llm-d-inference-sim:v0.4.0 | ||
imagePullPolicy: Always | ||
args: | ||
- --model | ||
- deepseek/deepseek-r1 | ||
- --port | ||
- "8000" | ||
- --max-loras | ||
- "2" | ||
- --lora-modules | ||
- '{"name": "food-review"}' | ||
- '{"name": "movie-critique"}' | ||
env: | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
ports: | ||
- containerPort: 8000 | ||
name: http | ||
protocol: TCP | ||
resources: | ||
requests: | ||
cpu: 10m |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: vllm-llama3-8b-instruct | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: vllm-llama3-8b-instruct | ||
template: | ||
metadata: | ||
labels: | ||
app: vllm-llama3-8b-instruct | ||
spec: | ||
containers: | ||
- name: vllm-sim | ||
image: ghcr.io/llm-d/llm-d-inference-sim:v0.4.0 | ||
imagePullPolicy: Always | ||
args: | ||
- --model | ||
- meta-llama/Llama-3.1-8B-Instruct | ||
- --port | ||
- "8000" | ||
- --max-loras | ||
- "2" | ||
- --lora-modules | ||
- '{"name": "food-review-1"}' | ||
- '{"name": "food-review-2"}' | ||
env: | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
ports: | ||
- containerPort: 8000 | ||
name: http | ||
protocol: TCP | ||
resources: | ||
requests: | ||
cpu: 10m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments
Always
(even when running on kind), since you want newly built images to download to the workers (from Kind, not docker)