|
| 1 | +# Adapter Rollout |
| 2 | + |
| 3 | +The goal of this guide is to demonstrate how to rollout a new adapter version. |
| 4 | + |
| 5 | +## **Prerequisites** |
| 6 | + |
| 7 | +Follow the steps in the [main guide](index.md) |
| 8 | + |
| 9 | + |
| 10 | +## **Safely rollout v2 adapter** |
| 11 | + |
| 12 | +### Load the new adapter version to the model servers |
| 13 | + |
| 14 | +This guide leverages the LoRA syncer sidecar to dynamically manage adapters within a vLLM deployment, enabling users to add or remove them through a shared ConfigMap. |
| 15 | + |
| 16 | + |
| 17 | +Modify the LoRA syncer ConfigMap to initiate loading of the new adapter version. |
| 18 | + |
| 19 | + |
| 20 | +```bash |
| 21 | + kubectl edit configmap vllm-llama2-7b-adapters |
| 22 | +``` |
| 23 | + |
| 24 | +Change the ConfigMap to match the following (note the new entry under models): |
| 25 | + |
| 26 | +```yaml |
| 27 | + apiVersion: v1 |
| 28 | + kind: ConfigMap |
| 29 | + metadata: |
| 30 | + name: vllm-llama2-7b-adapters |
| 31 | + data: |
| 32 | + configmap.yaml: | |
| 33 | + vLLMLoRAConfig: |
| 34 | + name: vllm-llama2-7b-adapters |
| 35 | + port: 8000 |
| 36 | + ensureExist: |
| 37 | + models: |
| 38 | + - base-model: meta-llama/Llama-2-7b-hf |
| 39 | + id: tweet-summary-1 |
| 40 | + source: vineetsharma/qlora-adapter-Llama-2-7b-hf-TweetSumm |
| 41 | + - base-model: meta-llama/Llama-2-7b-hf |
| 42 | + id: tweet-summary-2 |
| 43 | + source: mahimairaja/tweet-summarization-llama-2-finetuned |
| 44 | +``` |
| 45 | +
|
| 46 | +The new adapter version is applied to the model servers live, without requiring a restart. |
| 47 | +
|
| 48 | +
|
| 49 | +### Direct traffic to the new adapter version |
| 50 | +
|
| 51 | +Modify the InferenceModel to configure a canary rollout with traffic splitting. In this example, 10% of traffic for tweet-summary model will be sent to the new ***tweet-summary-2*** adapter. |
| 52 | +
|
| 53 | +
|
| 54 | +```bash |
| 55 | + kubectl edit inferencemodel tweet-summary |
| 56 | +``` |
| 57 | + |
| 58 | +Change the targetModels list in InferenceModel to match the following: |
| 59 | + |
| 60 | + |
| 61 | +```yaml |
| 62 | +apiVersion: inference.networking.x-k8s.io/v1alpha1 |
| 63 | +kind: InferenceModel |
| 64 | +metadata: |
| 65 | + name: inferencemodel-sample |
| 66 | +spec: |
| 67 | + modelName: tweet-summary |
| 68 | + criticality: Critical |
| 69 | + poolRef: |
| 70 | + name: vllm-llama2-7b-pool |
| 71 | + targetModels: |
| 72 | + - name: tweet-summary-1 |
| 73 | + weight: 90 |
| 74 | + - name: tweet-summary-2 |
| 75 | + weight: 10 |
| 76 | + |
| 77 | +``` |
| 78 | +
|
| 79 | +The above configuration means one in every ten requests should be sent to the new version. Try it out: |
| 80 | +
|
| 81 | +1. Get the gateway IP: |
| 82 | +```bash |
| 83 | +IP=$(kubectl get gateway/inference-gateway -o jsonpath='{.status.addresses[0].value}'); PORT=8081 |
| 84 | +``` |
| 85 | + |
| 86 | +2. Send a few requests as follows: |
| 87 | +```bash |
| 88 | +curl -i ${IP}:${PORT}/v1/completions -H 'Content-Type: application/json' -d '{ |
| 89 | +"model": "tweet-summary", |
| 90 | +"prompt": "Write as if you were a critic: San Francisco", |
| 91 | +"max_tokens": 100, |
| 92 | +"temperature": 0 |
| 93 | +}' |
| 94 | +``` |
| 95 | + |
| 96 | +### Finish the rollout |
| 97 | + |
| 98 | + |
| 99 | +Modify the InferenceModel to direct 100% of the traffic to the latest version of the adapter. |
| 100 | + |
| 101 | +```yaml |
| 102 | +model: |
| 103 | + name: tweet-summary |
| 104 | + targetModels: |
| 105 | + targetModelName: tweet-summary-2 |
| 106 | + weight: 100 |
| 107 | +``` |
| 108 | +
|
| 109 | +Unload the older versions from the servers by updating the LoRA syncer ConfigMap to list the older version under the `ensureNotExist` list: |
| 110 | + |
| 111 | +```yaml |
| 112 | + apiVersion: v1 |
| 113 | + kind: ConfigMap |
| 114 | + metadata: |
| 115 | + name: dynamic-lora-config |
| 116 | + data: |
| 117 | + configmap.yaml: | |
| 118 | + vLLMLoRAConfig: |
| 119 | + name: sql-loras-llama |
| 120 | + port: 8000 |
| 121 | + ensureExist: |
| 122 | + models: |
| 123 | + - base-model: meta-llama/Llama-2-7b-hf |
| 124 | + id: tweet-summary-2 |
| 125 | + source: mahimairaja/tweet-summarization-llama-2-finetuned |
| 126 | + ensureNotExist: |
| 127 | + models: |
| 128 | + - base-model: meta-llama/Llama-2-7b-hf |
| 129 | + id: tweet-summary-1 |
| 130 | + source: vineetsharma/qlora-adapter-Llama-2-7b-hf-TweetSumm |
| 131 | +``` |
| 132 | + |
| 133 | +With this, all requests should be served by the new adapter version. |
0 commit comments