Skip to content

Commit 3636e3b

Browse files
committed
Fix lint errors
Signed-off-by: Ira <[email protected]>
1 parent 31ed61a commit 3636e3b

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

pkg/llm-d-inference-sim/metrics_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,10 @@ var _ = Describe("Simulator metrics", Ordered, func() {
322322
Expect(err).NotTo(HaveOccurred())
323323
})
324324
It("Should send correct kv cache usage metrics", func() {
325-
modelName := "Qwen/Qwen2-0.5B"
326325
// Three requests, there are should be two blocks in the kv cache, because
327326
// the first and the second prompt share a block.
328327
ctx := context.TODO()
329-
args := []string{"cmd", "--model", modelName, "--mode", common.ModeRandom,
328+
args := []string{"cmd", "--model", qwenModelName, "--mode", common.ModeRandom,
330329
"--enable-kvcache", "true", "--kv-cache-size", "16", "--block-size", "8",
331330
"--time-to-first-token", "5000", "--tokenizers-cache-dir", tmpDir}
332331

@@ -342,19 +341,19 @@ var _ = Describe("Simulator metrics", Ordered, func() {
342341
Prompt: openai.CompletionNewParamsPromptUnion{
343342
OfString: openai.String("What is the weather like in Haifa today? Is it cold?"),
344343
},
345-
Model: openai.CompletionNewParamsModel(modelName),
344+
Model: openai.CompletionNewParamsModel(qwenModelName),
346345
},
347346
{
348347
Prompt: openai.CompletionNewParamsPromptUnion{
349348
OfString: openai.String("What is the weather like in Haifa today?"),
350349
},
351-
Model: openai.CompletionNewParamsModel(modelName),
350+
Model: openai.CompletionNewParamsModel(qwenModelName),
352351
},
353352
{
354353
Prompt: openai.CompletionNewParamsPromptUnion{
355354
OfString: openai.String("What is the weather like in New York today?"),
356355
},
357-
Model: openai.CompletionNewParamsModel(modelName),
356+
Model: openai.CompletionNewParamsModel(qwenModelName),
358357
},
359358
}
360359

@@ -402,9 +401,8 @@ var _ = Describe("Simulator metrics", Ordered, func() {
402401
})
403402

404403
It("Should send correct kv cache usage metrics for sequentual requests", func() {
405-
modelName := "Qwen/Qwen2-0.5B"
406404
ctx := context.TODO()
407-
args := []string{"cmd", "--model", modelName, "--mode", common.ModeRandom,
405+
args := []string{"cmd", "--model", qwenModelName, "--mode", common.ModeRandom,
408406
"--enable-kvcache", "true", "--kv-cache-size", "16", "--block-size", "8",
409407
"--time-to-first-token", "5000", "--tokenizers-cache-dir", tmpDir, "--max-num-seqs", "2"}
410408

@@ -420,19 +418,19 @@ var _ = Describe("Simulator metrics", Ordered, func() {
420418
Prompt: openai.CompletionNewParamsPromptUnion{
421419
OfString: openai.String("What is the weather like in Haifa today? Is it cold?"),
422420
},
423-
Model: openai.CompletionNewParamsModel(modelName),
421+
Model: openai.CompletionNewParamsModel(qwenModelName),
424422
},
425423
{
426424
Prompt: openai.CompletionNewParamsPromptUnion{
427425
OfString: openai.String("What is the weather like in Haifa today?"),
428426
},
429-
Model: openai.CompletionNewParamsModel(modelName),
427+
Model: openai.CompletionNewParamsModel(qwenModelName),
430428
},
431429
{
432430
Prompt: openai.CompletionNewParamsPromptUnion{
433431
OfString: openai.String("What is the weather like in New York today?"),
434432
},
435-
Model: openai.CompletionNewParamsModel(modelName),
433+
Model: openai.CompletionNewParamsModel(qwenModelName),
436434
},
437435
}
438436

pkg/llm-d-inference-sim/simulator_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
)
4343

4444
const model = "my_model"
45+
const qwenModelName = "Qwen/Qwen2-0.5B"
4546
const baseURL = "http://localhost/v1"
4647
const userMessage = "This is a test."
4748
const invalidMaxTokensErrMsg = "Max completion tokens and max tokens should be positive"
@@ -1081,10 +1082,10 @@ var _ = Describe("Simulator", func() {
10811082

10821083
It("Should return correct response to /tokenize chat", func() {
10831084
ctx := context.TODO()
1084-
modelName := "Qwen/Qwen2-0.5B"
1085-
tmpDir := "./tests-tmp/"
1085+
tmpDir := "./tmp/"
1086+
//nolint
10861087
defer os.RemoveAll(tmpDir)
1087-
args := []string{"cmd", "--model", modelName, "--mode", common.ModeRandom,
1088+
args := []string{"cmd", "--model", qwenModelName, "--mode", common.ModeRandom,
10881089
"--tokenizers-cache-dir", tmpDir}
10891090
client, err := startServerWithArgs(ctx, common.ModeRandom, args, nil)
10901091
Expect(err).NotTo(HaveOccurred())
@@ -1113,10 +1114,10 @@ var _ = Describe("Simulator", func() {
11131114

11141115
It("Should return correct response to /tokenize text", func() {
11151116
ctx := context.TODO()
1116-
modelName := "Qwen/Qwen2-0.5B"
1117-
tmpDir := "./tests-tmp/"
1117+
tmpDir := "./tmp/"
1118+
//nolint
11181119
defer os.RemoveAll(tmpDir)
1119-
args := []string{"cmd", "--model", modelName, "--mode", common.ModeRandom,
1120+
args := []string{"cmd", "--model", qwenModelName, "--mode", common.ModeRandom,
11201121
"--tokenizers-cache-dir", tmpDir}
11211122
client, err := startServerWithArgs(ctx, common.ModeRandom, args, nil)
11221123
Expect(err).NotTo(HaveOccurred())

pkg/vllm-api/tokenize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (t *TokenizeRequest) GetPrompt() string {
4141
return t.Prompt
4242
}
4343

44-
var messages []string
44+
messages := make([]string, 0)
4545
for _, message := range t.Messages {
4646
messages = append(messages, message.Content.PlainText())
4747
}

0 commit comments

Comments
 (0)