@@ -25,8 +25,7 @@ import (
25
25
)
26
26
27
27
const (
28
- qwenModelName = "Qwen/Qwen2-0.5B"
29
- seedInConfigFile = 100100100
28
+ qwenModelName = "Qwen/Qwen2-0.5B"
30
29
)
31
30
32
31
func createSimConfig (args []string ) (* configuration , error ) {
@@ -46,6 +45,33 @@ func createSimConfig(args []string) (*configuration, error) {
46
45
return s .config , nil
47
46
}
48
47
48
+ func createDefaultBasicConfig (model string ) * configuration {
49
+ c := newConfig ()
50
+
51
+ c .Model = model
52
+ c .ServedModelNames = []string {c .Model }
53
+ c .MaxNumSeqs = 5
54
+ c .MaxLoras = 1
55
+ c .MaxCPULoras = 1
56
+ c .TimeToFirstToken = 2000
57
+ c .InterTokenLatency = 1000
58
+ c .KVCacheTransferLatency = 100
59
+ c .Seed = 100100100
60
+ c .LoraModules = []loraModule {}
61
+
62
+ return c
63
+ }
64
+
65
+ func createDefaultConfig (model string ) * configuration {
66
+ c := createDefaultBasicConfig (model )
67
+
68
+ // parameters special to config.yaml
69
+ c .MaxLoras = 2
70
+ c .MaxCPULoras = 5
71
+
72
+ return c
73
+ }
74
+
49
75
type testCase struct {
50
76
name string
51
77
args []string
@@ -69,17 +95,10 @@ var _ = Describe("Simulator configuration", func() {
69
95
tests = append (tests , test )
70
96
71
97
// Config from config.yaml file
72
- c = newConfig ( )
98
+ c = createDefaultConfig ( qwenModelName )
73
99
c .Port = 8001
74
- c .Model = qwenModelName
75
100
c .ServedModelNames = []string {"model1" , "model2" }
76
- c .MaxLoras = 2
77
- c .MaxCPULoras = 5
78
- c .MaxNumSeqs = 5
79
- c .TimeToFirstToken = 2
80
- c .InterTokenLatency = 1
81
101
c .LoraModules = []loraModule {{Name : "lora1" , Path : "/path/to/lora1" }, {Name : "lora2" , Path : "/path/to/lora2" }}
82
- c .Seed = seedInConfigFile
83
102
test = testCase {
84
103
name : "config file" ,
85
104
args : []string {"cmd" , "--config" , "../../manifests/config.yaml" },
@@ -92,15 +111,9 @@ var _ = Describe("Simulator configuration", func() {
92
111
tests = append (tests , test )
93
112
94
113
// Config from config.yaml file plus command line args
95
- c = newConfig ( )
114
+ c = createDefaultConfig ( model )
96
115
c .Port = 8002
97
- c .Model = model
98
116
c .ServedModelNames = []string {"alias1" , "alias2" }
99
- c .MaxLoras = 2
100
- c .MaxCPULoras = 5
101
- c .MaxNumSeqs = 5
102
- c .TimeToFirstToken = 2
103
- c .InterTokenLatency = 1
104
117
c .Seed = 100
105
118
c .LoraModules = []loraModule {{Name : "lora3" , Path : "/path/to/lora3" }, {Name : "lora4" , Path : "/path/to/lora4" }}
106
119
c .LoraModulesString = []string {
@@ -118,16 +131,8 @@ var _ = Describe("Simulator configuration", func() {
118
131
tests = append (tests , test )
119
132
120
133
// Config from config.yaml file plus command line args with different format
121
- c = newConfig ( )
134
+ c = createDefaultConfig ( model )
122
135
c .Port = 8002
123
- c .Model = model
124
- c .ServedModelNames = []string {c .Model }
125
- c .MaxLoras = 2
126
- c .MaxCPULoras = 5
127
- c .MaxNumSeqs = 5
128
- c .TimeToFirstToken = 2
129
- c .InterTokenLatency = 1
130
- c .Seed = seedInConfigFile
131
136
c .LoraModules = []loraModule {{Name : "lora3" , Path : "/path/to/lora3" }}
132
137
c .LoraModulesString = []string {
133
138
"{\" name\" :\" lora3\" ,\" path\" :\" /path/to/lora3\" }" ,
@@ -143,16 +148,8 @@ var _ = Describe("Simulator configuration", func() {
143
148
tests = append (tests , test )
144
149
145
150
// Config from config.yaml file plus command line args with empty string
146
- c = newConfig ( )
151
+ c = createDefaultConfig ( model )
147
152
c .Port = 8002
148
- c .Model = model
149
- c .ServedModelNames = []string {c .Model }
150
- c .MaxLoras = 2
151
- c .MaxCPULoras = 5
152
- c .MaxNumSeqs = 5
153
- c .TimeToFirstToken = 2
154
- c .InterTokenLatency = 1
155
- c .Seed = seedInConfigFile
156
153
c .LoraModules = []loraModule {{Name : "lora3" , Path : "/path/to/lora3" }}
157
154
c .LoraModulesString = []string {
158
155
"{\" name\" :\" lora3\" ,\" path\" :\" /path/to/lora3\" }" ,
@@ -168,18 +165,10 @@ var _ = Describe("Simulator configuration", func() {
168
165
tests = append (tests , test )
169
166
170
167
// Config from config.yaml file plus command line args with empty string for loras
171
- c = newConfig ( )
168
+ c = createDefaultConfig ( qwenModelName )
172
169
c .Port = 8001
173
- c .Model = qwenModelName
174
170
c .ServedModelNames = []string {"model1" , "model2" }
175
- c .MaxLoras = 2
176
- c .MaxCPULoras = 5
177
- c .MaxNumSeqs = 5
178
- c .TimeToFirstToken = 2
179
- c .InterTokenLatency = 1
180
- c .LoraModules = []loraModule {}
181
171
c .LoraModulesString = []string {}
182
- c .Seed = seedInConfigFile
183
172
test = testCase {
184
173
name : "config file with command line args with empty string for loras" ,
185
174
args : []string {"cmd" , "--config" , "../../manifests/config.yaml" , "--lora-modules" , "" },
@@ -188,25 +177,28 @@ var _ = Describe("Simulator configuration", func() {
188
177
tests = append (tests , test )
189
178
190
179
// Config from config.yaml file plus command line args with empty parameter for loras
191
- c = newConfig ( )
180
+ c = createDefaultConfig ( qwenModelName )
192
181
c .Port = 8001
193
- c .Model = qwenModelName
194
182
c .ServedModelNames = []string {"model1" , "model2" }
195
- c .MaxLoras = 2
196
- c .MaxCPULoras = 5
197
- c .MaxNumSeqs = 5
198
- c .TimeToFirstToken = 2
199
- c .InterTokenLatency = 1
200
- c .LoraModules = []loraModule {}
201
183
c .LoraModulesString = []string {}
202
- c .Seed = seedInConfigFile
203
184
test = testCase {
204
185
name : "config file with command line args with empty parameter for loras" ,
205
186
args : []string {"cmd" , "--config" , "../../manifests/config.yaml" , "--lora-modules" },
206
187
expectedConfig : c ,
207
188
}
208
189
tests = append (tests , test )
209
190
191
+ // Config from config.yaml file plus command line args with time to copy cache
192
+ c = createDefaultBasicConfig (qwenModelName )
193
+ c .Port = 8001
194
+ c .KVCacheTransferLatency = 50
195
+ test = testCase {
196
+ name : "config file with command line args with time to transfer kv-cache" ,
197
+ args : []string {"cmd" , "--config" , "../../manifests/basic-config.yaml" , "--kv_cache_transfer_latency" , "50" },
198
+ expectedConfig : c ,
199
+ }
200
+ tests = append (tests , test )
201
+
210
202
// Invalid configurations
211
203
test = testCase {
212
204
name : "invalid model" ,
@@ -258,14 +250,14 @@ var _ = Describe("Simulator configuration", func() {
258
250
Entry (tests [4 ].name , tests [4 ].args , tests [4 ].expectedConfig ),
259
251
Entry (tests [5 ].name , tests [5 ].args , tests [5 ].expectedConfig ),
260
252
Entry (tests [6 ].name , tests [6 ].args , tests [6 ].expectedConfig ),
253
+ Entry (tests [7 ].name , tests [7 ].args , tests [7 ].expectedConfig ),
261
254
)
262
255
263
256
DescribeTable ("invalid configurations" ,
264
257
func (args []string ) {
265
258
_ , err := createSimConfig (args )
266
259
Expect (err ).To (HaveOccurred ())
267
260
},
268
- Entry (tests [7 ].name , tests [7 ].args ),
269
261
Entry (tests [8 ].name , tests [8 ].args ),
270
262
Entry (tests [9 ].name , tests [9 ].args ),
271
263
Entry (tests [10 ].name , tests [10 ].args ),
0 commit comments