Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 4f431a2

Browse files
fix: model not found
1 parent 3de60d7 commit 4f431a2

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cortex-js/src/infrastructure/commanders/usecases/benchmark.cli.usecases.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class BenchmarkCliUsecases {
6666
if (!model)
6767
throw new Error('Model is not started, please try again!');
6868
})
69-
.then(() => this.runBenchmarks())
69+
.then(() => this.runBenchmarks(model))
7070
.then(() => {
7171
serveProcess.kill();
7272
process.exit(0);
@@ -136,19 +136,26 @@ export class BenchmarkCliUsecases {
136136
* Benchmark a user using the OpenAI API
137137
* @returns
138138
*/
139-
private async benchmarkUser() {
139+
private async benchmarkUser(model: string) {
140140
const startResources = await this.getSystemResources();
141141
const start = Date.now();
142142
let tokenCount = 0;
143143
let firstTokenTime = null;
144144

145145
try {
146+
console.log('Benchmarking user...', {
147+
model,
148+
messages: this.config.api.parameters.messages,
149+
max_tokens: this.config.api.parameters.max_tokens,
150+
stream: true,
151+
});
146152
const stream = await this.cortexClient!.chat.completions.create({
147-
model: this.config.api.parameters.model,
153+
model,
148154
messages: this.config.api.parameters.messages,
149155
max_tokens: this.config.api.parameters.max_tokens,
150156
stream: true,
151157
});
158+
152159

153160
for await (const chunk of stream) {
154161
if (!firstTokenTime && chunk.choices[0]?.delta?.content) {
@@ -204,7 +211,7 @@ export class BenchmarkCliUsecases {
204211
/**
205212
* Run the benchmarks
206213
*/
207-
private async runBenchmarks() {
214+
private async runBenchmarks(model: string) {
208215
const allResults: any[] = [];
209216
const rounds = this.config.num_rounds || 1;
210217

@@ -216,7 +223,7 @@ export class BenchmarkCliUsecases {
216223
const hardwareBefore = await this.getSystemResources();
217224

218225
for (let j = 0; j < this.config.concurrency; j++) {
219-
const result = await this.benchmarkUser();
226+
const result = await this.benchmarkUser(model);
220227
if (result) {
221228
roundResults.push(result);
222229
}

cortex-js/src/infrastructure/constants/benchmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const defaultBenchmarkConfiguration: BenchmarkConfig = {
2828
min: 1024,
2929
max: 2048,
3030
samples: 10,
31-
},
31+
},
3232
output: 'table',
3333
hardware: ['cpu', 'gpu', 'psu', 'chassis', 'ram'],
3434
concurrency: 1,

0 commit comments

Comments
 (0)