forked from ysdede/parakeet.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_webgpu_simple.js
More file actions
49 lines (37 loc) · 1.51 KB
/
Copy pathtest_webgpu_simple.js
File metadata and controls
49 lines (37 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Simple WebGPU test for parakeet.js
import { getParakeetModel, ParakeetModel } from './src/index.js';
import * as fs from 'fs';
console.log('Testing WebGPU support...');
// Test 1: Check if WebGPU is available
console.log('1. WebGPU API available:', 'gpu' in navigator);
// Test 2: Check if ONNX Runtime can be imported
import { initOrt } from './src/backend.js';
async function testBackend() {
try {
console.log('2. Testing backend initialization...');
const ort = await initOrt({ backend: 'webgpu' });
console.log('✓ Backend initialized successfully');
console.log('Available execution providers:', ort.env.availableExecutionProviders);
// Test 3: Check if we can load model files from Hub
console.log('3. Testing Hub integration...');
const { getParakeetModel } = await import('./src/hub.js');
const result = await getParakeetModel('istupakov/parakeet-tdt-0.6b-v2-onnx', {
quantization: 'int8',
preprocessor: 'nemo128'
});
console.log('✓ Model URLs retrieved:', Object.keys(result.urls));
// Test 4: Try to create a model instance
console.log('4. Testing model creation...');
const { ParakeetModel } = await import('./src/parakeet.js');
const model = await ParakeetModel.fromUrls({
...result.urls,
filenames: result.filenames,
backend: 'wasm'
});
console.log('✓ Model loaded successfully');
console.log('Model ready for transcription!');
} catch (error) {
console.error('❌ Test failed:', error);
}
}
testBackend();