"...workflows/git@developer.sourcefind.cn:SIYIXNI/vllm.git" did not exist on "390b495ff327e8548c3f7cd701afce87870d9102"
Unverified Commit f15a9b61 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Fix check gpu index logic in local mode (#3163)

parent 9710f170
...@@ -58,12 +58,12 @@ class GPUScheduler { ...@@ -58,12 +58,12 @@ class GPUScheduler {
return []; return [];
} }
public getSystemGpuCount(): number { public getSystemGpuCount(): number | undefined{
if (this.gpuSummary !== undefined) { if (this.gpuSummary !== undefined) {
return this.gpuSummary.gpuCount; return this.gpuSummary.gpuCount;
} }
return 0; return undefined;
} }
public async stop(): Promise<void> { public async stop(): Promise<void> {
......
...@@ -435,8 +435,8 @@ class LocalTrainingService implements TrainingService { ...@@ -435,8 +435,8 @@ class LocalTrainingService implements TrainingService {
} }
private checkSpecifiedGpuIndices(): void { private checkSpecifiedGpuIndices(): void {
const gpuCount: number = this.gpuScheduler.getSystemGpuCount(); const gpuCount: number | undefined = this.gpuScheduler.getSystemGpuCount();
if (this.designatedGpuIndices !== undefined) { if (this.designatedGpuIndices !== undefined && gpuCount !== undefined) {
for (const index of this.designatedGpuIndices) { for (const index of this.designatedGpuIndices) {
if (index >= gpuCount) { if (index >= gpuCount) {
throw new Error(`Specified GPU index not found: ${index}`); throw new Error(`Specified GPU index not found: ${index}`);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment