Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: model not found #808

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class BenchmarkCliUsecases {
if (!model)
throw new Error('Model is not started, please try again!');
})
.then(() => this.runBenchmarks())
.then(() => this.runBenchmarks(model))
.then(() => {
serveProcess.kill();
process.exit(0);
Expand Down Expand Up @@ -136,19 +136,26 @@ export class BenchmarkCliUsecases {
* Benchmark a user using the OpenAI API
* @returns
*/
private async benchmarkUser() {
private async benchmarkUser(model: string) {
const startResources = await this.getSystemResources();
const start = Date.now();
let tokenCount = 0;
let firstTokenTime = null;

try {
console.log('Benchmarking user...', {
model,
messages: this.config.api.parameters.messages,
max_tokens: this.config.api.parameters.max_tokens,
stream: true,
});
const stream = await this.cortexClient!.chat.completions.create({
model: this.config.api.parameters.model,
model,
messages: this.config.api.parameters.messages,
max_tokens: this.config.api.parameters.max_tokens,
stream: true,
});


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

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

for (let j = 0; j < this.config.concurrency; j++) {
const result = await this.benchmarkUser();
const result = await this.benchmarkUser(model);
if (result) {
roundResults.push(result);
}
Expand Down
2 changes: 1 addition & 1 deletion cortex-js/src/infrastructure/constants/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const defaultBenchmarkConfiguration: BenchmarkConfig = {
min: 1024,
max: 2048,
samples: 10,
},
},
output: 'table',
hardware: ['cpu', 'gpu', 'psu', 'chassis', 'ram'],
concurrency: 1,
Expand Down
Loading