INNER CODE UNIT · TypeScript

parseGpuConfig

modal-labs/modal-client · js/src/app.ts:62

export function parseGpuConfig(gpu: string | undefined): GPUConfig {
  if (!gpu) {
    return GPUConfig.create({});
  }

  let gpuType = gpu;
  let count = 1;

  if (gpu.includes(":")) {
    const [type, countStr] = gpu.split(":", 2);
    gpuType = type;
    count = parseInt(countStr, 10);
    if (isNaN(count) || count < 1) {
      throw new Error(
        `Invalid GPU count: ${countStr}. Value must be a positive integer.`,
      );
    }
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…