Skip to content

Commit

Permalink
feat(): turn on webgpu for ocr and speech-recog
Browse files Browse the repository at this point in the history
  • Loading branch information
jgw96 committed Aug 14, 2024
1 parent a896ab4 commit 3349265
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/services/ocr/ocr-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ async function loadOCR(model: string): Promise<void> {
if (!ocr) {
env.allowLocalModels = false;
env.useBrowserCache = false;
ocr = await pipeline('image-to-text', model || 'Xenova/trocr-small-printed');
ocr = await pipeline('image-to-text', model || 'Xenova/trocr-small-printed', {
device: "webgpu"
});
console.log("loaded ocr", ocr)
resolve();
}
Expand Down
3 changes: 2 additions & 1 deletion src/services/speech-recognition/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export async function loadTranscriber(model: string = "Xenova/whisper-tiny", tim
transcriber = await pipeline('automatic-speech-recognition', model || 'Xenova/whisper-tiny', {
// @ts-ignore
return_timestamps: timestamps,
language
language,
device: "webgpu"
});

resolve();
Expand Down

0 comments on commit 3349265

Please sign in to comment.