jamezmca / free-scribe

React web based transcription & translation app that uses web workers to run ML models in the browser
37 stars 17 forks source link

Please help: error with translate.worker.js or Xenova/nllb-200-distilled-600M #2

Open ynamite opened 4 months ago

ynamite commented 4 months ago

Hey there, Thanks for the lovely ML tutorial. Unfortunately I'm stuck with the following console error after attempting to translate a transcribed result (after choosing a language and clicking translate):

ncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at getModelJSON (http://localhost:5173/node_modules/.vite/deps/@xenova_transformers.js?v=d6048e6e:14328:15)
    at async Promise.all (index 0)
    at async loadTokenizer (http://localhost:5173/node_modules/.vite/deps/@xenova_transformers.js?v=d6048e6e:17831:16)
    at async AutoTokenizer.from_pretrained (http://localhost:5173/node_modules/.vite/deps/@xenova_transformers.js?v=d6048e6e:21018:46)
    at async Promise.all (index 0)
    at async loadItems (http://localhost:5173/node_modules/.vite/deps/@xenova_transformers.js?v=d6048e6e:29508:3)
    at async pipeline (http://localhost:5173/node_modules/.vite/deps/@xenova_transformers.js?v=d6048e6e:29469:19)
    at async http://localhost:5173/src/utils/translate.worker.js?worker_file&type=module:22:22

If I log out the last progress update before the error, I get the following, which looks good to me:

{
    "status": "progress",
    "name": "Xenova/nllb-200-distilled-600M",
    "file": "tokenizer.json",
    "progress": 100,
    "loaded": 1762,
    "total": 1762
}

I do get a done but never a complete status from the worker.

ynamite commented 4 months ago

This happens regardless of whether I'm in a private or a normal browser window

ynamite commented 4 months ago

I've also tried downgrading xenova from 2.17.2 to 2.4.2, the same version your repo uses. While there's no error message with this older version, the worker just never stops running at all and never reaches the complete status 🤷

ynamite commented 4 months ago

I've cloned your repo and tried it in a private tab, same problem. Translation never completes, it just runs and runs.

Hemanth12-git commented 4 months ago

I am too getting the same error on the console. Did you come up with a solution for this ?

I tried many methods but couldnt come up with a solution. If you have already rectified this error, could you kindly post the solution ?

ynamite commented 4 months ago

Nope, I eventually gave up and went onto another tutorial

jamezmca commented 4 months ago

so adding the following lines as you commented in another issue didn't resolve it? I presume it also failed in all other browser windows (both normal and incognito)?

import { pipeline, env } from '@xenova/transformers';
env.allowLocalModels = false;
env.useBrowserCache = false;
ynamite commented 4 months ago

@jamezmca no, the solution in the other issue gets rid of the Unexpected token error, but the translation still never resolves/completes.

I didn't spend too much time on it to be honest.

jamezmca commented 4 months ago

@ynamite ahh that's a pain - it seems to be a super random bug. Cheers for your other solution and I'll have a closer look at this as soon as I get a chance!

ynamite commented 4 months ago

@jamezmca ah no worries, thanks for the awesome tutorial, learnt a ton from it.

Hemanth12-git commented 4 months ago

Yeah , Kindly share the solution as soon as it is solved because I m doing this as my college's minor project. Haha

jasirjaleel commented 3 months ago

Did anyone found out the issue. If so kindly share it