fix: 将语音分词器切换到 CPU (#2193)
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Failed
Pipelines as Code CI / unidesk-host- Success

Co-authored-by: Codex <codex@local>
This commit is contained in:
Lyon
2026-07-15 18:29:45 +08:00
committed by GitHub
parent 95954ee277
commit 64af7e39e8
4 changed files with 20 additions and 53 deletions
@@ -68,7 +68,7 @@ interface VoiceConfig {
speed: { min: number; max: number };
cudaAllocator: string;
cudaModuleLoading: string;
onnxCuda: { gpuMemLimitMiB: number; arenaExtendStrategy: "kSameAsRequested" | "kNextPowerOfTwo"; cudnnConvUseMaxWorkspace: boolean };
speechTokenizerProvider: "CPUExecutionProvider";
};
operations: { applyTimeoutSeconds: number };
smoke: { healthPath: string; speechPath: string; text: string; voice: string; timeoutSeconds: number };
@@ -208,10 +208,7 @@ function readConfig(): VoiceConfig {
if (config.runtime.inference.concurrency !== "serial") throw new Error(`${configLabel}.runtime.inference.concurrency must be serial`);
if (config.runtime.inference.referenceVoice !== config.image.referenceVoice.id) throw new Error(`${configLabel}.runtime.inference.referenceVoice must select image.referenceVoice.id`);
if (typeof config.runtime.inference.speed.min !== "number" || typeof config.runtime.inference.speed.max !== "number" || config.runtime.inference.speed.min >= config.runtime.inference.speed.max) throw new Error(`${configLabel}.runtime.inference.speed must declare an increasing numeric range`);
requireInteger(config.runtime.inference.onnxCuda.gpuMemLimitMiB, "runtime.inference.onnxCuda.gpuMemLimitMiB");
if (config.runtime.inference.onnxCuda.gpuMemLimitMiB <= 0) throw new Error(`${configLabel}.runtime.inference.onnxCuda.gpuMemLimitMiB must be positive`);
if (!["kSameAsRequested", "kNextPowerOfTwo"].includes(config.runtime.inference.onnxCuda.arenaExtendStrategy)) throw new Error(`${configLabel}.runtime.inference.onnxCuda.arenaExtendStrategy is unsupported`);
if (typeof config.runtime.inference.onnxCuda.cudnnConvUseMaxWorkspace !== "boolean") throw new Error(`${configLabel}.runtime.inference.onnxCuda.cudnnConvUseMaxWorkspace must be a boolean`);
if (config.runtime.inference.speechTokenizerProvider !== "CPUExecutionProvider") throw new Error(`${configLabel}.runtime.inference.speechTokenizerProvider must be CPUExecutionProvider`);
return config;
}
@@ -388,9 +385,7 @@ function runtimeEnv(config: VoiceConfig, target: VoiceTarget): string {
VOICE_SPEED_MAX: config.runtime.inference.speed.max,
PYTORCH_CUDA_ALLOC_CONF: config.runtime.inference.cudaAllocator,
CUDA_MODULE_LOADING: config.runtime.inference.cudaModuleLoading,
VOICE_ONNX_CUDA_GPU_MEM_LIMIT_MIB: config.runtime.inference.onnxCuda.gpuMemLimitMiB,
VOICE_ONNX_CUDA_ARENA_EXTEND_STRATEGY: config.runtime.inference.onnxCuda.arenaExtendStrategy,
VOICE_ONNX_CUDA_CUDNN_CONV_USE_MAX_WORKSPACE: String(config.runtime.inference.onnxCuda.cudnnConvUseMaxWorkspace),
VOICE_SPEECH_TOKENIZER_PROVIDER: config.runtime.inference.speechTokenizerProvider,
FRPC_IMAGE: config.frp.images.frpc,
};
return Object.entries(values).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";