Code Monkey home page Code Monkey logo

Comments (6)

syl22-00 avatar syl22-00 commented on September 13, 2024

Hi @Jsignr , could you share a little bit more details about what you did? Have model files been pre-loaded successfully? Or maybe you can share your files.

You should not need to give a -tmat argument if you set -hmm in your config.

from pocketsphinx.js.

Jsignr avatar Jsignr commented on September 13, 2024

Thanks for you reply.

I would like package model files outside the main JavaScript because I can't embedding french model acoustic (http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F0%20Broadcast%20News%20Acoustic%20Model/) into JS file (I get fatal error : CALL_AND_RETRY_2 Allocation failed - process out of memory).

So, I have generated pocketsphinx.js with
cmake -DEMSCRIPTEN=1 -DHMM_EMBED=OFF -DCMAKE_TOOLCHAIN_FILE=path_to_emscripten/cmake/Platform/Emscripten.cmake

and

python .../emscripten/tools/file_packager.py .../pocketsphinx.js/build/pocketsphinx.js --embed ..... for each file on my model folder

My simple JS :

window.onload = function() {

var recognizer = new Worker("js/recognizer.js");
recognizer.onmessage = function(event) {
console.log('Recognizer Ready');
};

var id = 0;
recognizer.postMessage('pocketsphinx.js');
recognizer.postMessage({command: 'load',
callbackId: id,
data: ["model/mdef.js",
"model/variances.js",
"model/means.js",
"model/mixture_weights.js",
"model/noisedict.js",
"model/transition_matrices.js",
]
});
recognizer.postMessage({command: 'initialize',
callbackId: id,
});
};

from pocketsphinx.js.

syl22-00 avatar syl22-00 commented on September 13, 2024

I was actually trying to do the same yesterday, with that model, and found that variances.js and means.js can not be loaded. I suspect these two files, who ended up very large (80+MB) are larger than some limit in the browser.

For you, what probably happens is that it went on trying to initialize the recognizer, and failed finding the files that were not loaded.

I'll dig further and update this thread if I find anything useful.

from pocketsphinx.js.

Jsignr avatar Jsignr commented on September 13, 2024

ok thanks :) I will check if it's possible to increase limit browser or other solutions.

from pocketsphinx.js.

syl22-00 avatar syl22-00 commented on September 13, 2024

@Jsignr so I think I got a fix:

The issue was with the array created from the binary file which requires a gigantic JavaScript line to be created, over the limit.

By adjusting the packaging script, that array can be created by concatenating smaller chunks, and finally the virtual file can be created successfully.

You can find the generated model there:
https://github.com/syl22-00/pocketsphinx.js-fr_FR-lium_french_f0

Note that you will need to set TOTAL_MEMORY to something larger. I just set it to 100MB.

And if you want to package it yourself, the modified version of file_packager.py is there:
https://github.com/syl22-00/emscripten/blob/master/tools/file_packager.py

I will then clean it up and make a full request to upstream Emscripten.

Would be great if you could update this ticket, whether you can use it successfully or not.

from pocketsphinx.js.

Jsignr avatar Jsignr commented on September 13, 2024

It works ! Thanks a lot for your help ! :-)

from pocketsphinx.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.