Skip to content

Commit

Permalink
chore: system resource events should include gpu system information (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Aug 12, 2024
1 parent 9391650 commit 80b0350
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions cortex-js/src/domain/models/resource.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ export interface ResourceStatus {
cpu: {
usage: number;
};
gpus: GpuInfo[];
}

export interface UsedMemInfo {
total: number;
used: number;
}

export interface GpuInfo {
name: string | undefined;
vram: number | null;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import osUtils from 'node-os-utils'
import {
ResourceStatus,
UsedMemInfo,
} from '@/domain/models/resource.interface';
import { getMemoryInformation, MemoryInformation } from '@/utils/system-resource';
import { Injectable } from '@nestjs/common';
import systemInformation, { Systeminformation } from 'systeminformation';
import si, { Systeminformation } from 'systeminformation';

@Injectable()
export class ResourcesManagerService {
async getResourceStatuses(): Promise<ResourceStatus> {
const promises = [systemInformation.currentLoad(), getMemoryInformation()];
const promises = [si.currentLoad(), getMemoryInformation()];
const results = await Promise.all(promises);

const cpuUsage = results[0] as Systeminformation.CurrentLoadData;
Expand All @@ -19,12 +18,15 @@ export class ResourcesManagerService {
total: memory.total,
used: memory.used,
};

return {
mem: memInfo,
cpu: {
usage: Number(cpuUsage.currentLoad.toFixed(2)),
},
gpus: (await si.graphics()).controllers.map((gpu) => ({
name: gpu.name,
vram: gpu.vram,
})),
};
}
}
2 changes: 1 addition & 1 deletion cortex-js/src/usecases/models/models.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export class ModelsUsecases {

// Default Inference Params
stream: true,
max_tokens: 4098,
max_tokens: 4096,
frequency_penalty: 0.7,
presence_penalty: 0.7,
temperature: 0.7,
Expand Down

0 comments on commit 80b0350

Please sign in to comment.