@@ -80,7 +80,7 @@ func TestGetArgs(t *testing.T) {
8080 },
8181 mode : inference .BackendModeCompletion ,
8282 config : & inference.BackendConfiguration {
83- ContextSize : 8192 ,
83+ ContextSize : int32ptr ( 8192 ) ,
8484 },
8585 expected : []string {
8686 "-m" ,
@@ -95,39 +95,17 @@ func TestGetArgs(t *testing.T) {
9595 "8192" ,
9696 },
9797 },
98- {
99- name : "with runtime flags" ,
100- bundle : & mockModelBundle {
101- safetensorsPath : "/path/to/model/model.safetensors" ,
102- },
103- mode : inference .BackendModeCompletion ,
104- config : & inference.BackendConfiguration {
105- RuntimeFlags : []string {"--mem-fraction-static" , "0.9" },
106- },
107- expected : []string {
108- "-m" ,
109- "sglang.launch_server" ,
110- "--model-path" ,
111- "/path/to/model" ,
112- "--host" ,
113- "127.0.0.1" ,
114- "--port" ,
115- "30000" ,
116- "--mem-fraction-static" ,
117- "0.9" ,
118- },
119- },
12098 {
12199 name : "with model context size (takes precedence)" ,
122100 bundle : & mockModelBundle {
123101 safetensorsPath : "/path/to/model/model.safetensors" ,
124102 runtimeConfig : types.Config {
125- ContextSize : ptrUint64 (16384 ),
103+ ContextSize : int32ptr (16384 ),
126104 },
127105 },
128106 mode : inference .BackendModeCompletion ,
129107 config : & inference.BackendConfiguration {
130- ContextSize : 8192 ,
108+ ContextSize : int32ptr ( 8192 ) ,
131109 },
132110 expected : []string {
133111 "-m" ,
@@ -179,32 +157,6 @@ func TestGetArgs(t *testing.T) {
179157 "30000" ,
180158 },
181159 },
182- {
183- name : "combined config with context size and runtime flags" ,
184- bundle : & mockModelBundle {
185- safetensorsPath : "/path/to/model/model.safetensors" ,
186- },
187- mode : inference .BackendModeCompletion ,
188- config : & inference.BackendConfiguration {
189- ContextSize : 4096 ,
190- RuntimeFlags : []string {"--tp-size" , "2" , "--enable-flashinfer" },
191- },
192- expected : []string {
193- "-m" ,
194- "sglang.launch_server" ,
195- "--model-path" ,
196- "/path/to/model" ,
197- "--host" ,
198- "127.0.0.1" ,
199- "--port" ,
200- "30000" ,
201- "--context-length" ,
202- "4096" ,
203- "--tp-size" ,
204- "2" ,
205- "--enable-flashinfer" ,
206- },
207- },
208160 }
209161
210162 for _ , tt := range tests {
@@ -253,33 +205,33 @@ func TestGetContextLength(t *testing.T) {
253205 name : "backend config only" ,
254206 modelCfg : types.Config {},
255207 backendCfg : & inference.BackendConfiguration {
256- ContextSize : 4096 ,
208+ ContextSize : int32ptr ( 4096 ) ,
257209 },
258210 expectedValue : ptrUint64 (4096 ),
259211 },
260212 {
261213 name : "model config only" ,
262214 modelCfg : types.Config {
263- ContextSize : ptrUint64 (8192 ),
215+ ContextSize : int32ptr (8192 ),
264216 },
265217 backendCfg : nil ,
266218 expectedValue : ptrUint64 (8192 ),
267219 },
268220 {
269221 name : "model config takes precedence" ,
270222 modelCfg : types.Config {
271- ContextSize : ptrUint64 (16384 ),
223+ ContextSize : int32ptr (16384 ),
272224 },
273225 backendCfg : & inference.BackendConfiguration {
274- ContextSize : 4096 ,
226+ ContextSize : int32ptr ( 4096 ) ,
275227 },
276228 expectedValue : ptrUint64 (16384 ),
277229 },
278230 {
279231 name : "zero context size in backend config returns nil" ,
280232 modelCfg : types.Config {},
281233 backendCfg : & inference.BackendConfiguration {
282- ContextSize : 0 ,
234+ ContextSize : int32ptr ( 0 ) ,
283235 },
284236 expectedValue : nil ,
285237 },
@@ -300,3 +252,7 @@ func TestGetContextLength(t *testing.T) {
300252func ptrUint64 (v uint64 ) * uint64 {
301253 return & v
302254}
255+
256+ func int32ptr (v int32 ) * int32 {
257+ return & v
258+ }
0 commit comments