Skip to content

Commit 0e14167

Browse files
feat: add --cpu flag to force CPU-only mode for testing
Made-with: Cursor
1 parent d600940 commit 0e14167

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"run": "node src/start.js",
1111
"setup": "node src/start.js",
1212
"setup:debug": "node src/start.js --debug",
13+
"setup:cpu": "node src/start.js --cpu",
1314
"setup:install": "node src/start.js -i",
1415
"fix": "node scripts/fix-dependencies.js"
1516
},

src/start.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@ function shouldSkipInstall(forceReinstall = false) {
272272
}
273273

274274
async function getGPUStatus() {
275+
// --cpu flag or LOCALSTREAM_FORCE_CPU=1 skips the GPU test entirely.
276+
// Useful for testing CPU-mode behaviour without a CPU-only machine.
277+
const forceCPU = process.argv.includes('--cpu') || process.env.LOCALSTREAM_FORCE_CPU === '1';
278+
if (forceCPU) {
279+
debug('Force-CPU flag set — skipping GPU test', 'yellow');
280+
return { available: false, type: 'CPU (forced)', color: 'cyan', modelSource: null, modelPath: null };
281+
}
282+
275283
try {
276284
// Write GPU test script to temporary file - actually test GPU processing
277285
const testScript = `import sys
@@ -1783,7 +1791,7 @@ async function main() {
17831791
const modelInfo = WHISPER_MODELS.find(m => m.id === savedModel);
17841792
const cacheNote = modelCached ? '' : ` (${modelInfo?.size ?? '?'} download on first use)`;
17851793

1786-
log(`\n✅ Ready · ${deviceLabel} · ${savedModel}${cacheNote}`, 'green');
1794+
log(`\n✅ Ready ${deviceLabel} ${savedModel}${cacheNote}`, 'green');
17871795
if (cacheNote) log(' Model will be fetched from HuggingFace automatically when you first transcribe.', 'cyan');
17881796
debug(`Processing device: ${gpuStatus.type}`, gpuStatus.color);
17891797
if (gpuStatus.modelSource) debug(`Model source: ${gpuStatus.modelSource}`);

0 commit comments

Comments
 (0)