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

Commit 80b0350

Browse files
authored
chore: system resource events should include gpu system information (#1011)
1 parent 9391650 commit 80b0350

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

cortex-js/src/domain/models/resource.interface.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ export interface ResourceStatus {
77
cpu: {
88
usage: number;
99
};
10+
gpus: GpuInfo[];
1011
}
1112

1213
export interface UsedMemInfo {
1314
total: number;
1415
used: number;
1516
}
17+
18+
export interface GpuInfo {
19+
name: string | undefined;
20+
vram: number | null;
21+
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import osUtils from 'node-os-utils'
21
import {
32
ResourceStatus,
43
UsedMemInfo,
54
} from '@/domain/models/resource.interface';
65
import { getMemoryInformation, MemoryInformation } from '@/utils/system-resource';
76
import { Injectable } from '@nestjs/common';
8-
import systemInformation, { Systeminformation } from 'systeminformation';
7+
import si, { Systeminformation } from 'systeminformation';
98

109
@Injectable()
1110
export class ResourcesManagerService {
1211
async getResourceStatuses(): Promise<ResourceStatus> {
13-
const promises = [systemInformation.currentLoad(), getMemoryInformation()];
12+
const promises = [si.currentLoad(), getMemoryInformation()];
1413
const results = await Promise.all(promises);
1514

1615
const cpuUsage = results[0] as Systeminformation.CurrentLoadData;
@@ -19,12 +18,15 @@ export class ResourcesManagerService {
1918
total: memory.total,
2019
used: memory.used,
2120
};
22-
2321
return {
2422
mem: memInfo,
2523
cpu: {
2624
usage: Number(cpuUsage.currentLoad.toFixed(2)),
2725
},
26+
gpus: (await si.graphics()).controllers.map((gpu) => ({
27+
name: gpu.name,
28+
vram: gpu.vram,
29+
})),
2830
};
2931
}
3032
}

cortex-js/src/usecases/models/models.usecases.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export class ModelsUsecases {
513513

514514
// Default Inference Params
515515
stream: true,
516-
max_tokens: 4098,
516+
max_tokens: 4096,
517517
frequency_penalty: 0.7,
518518
presence_penalty: 0.7,
519519
temperature: 0.7,

0 commit comments

Comments
 (0)