av-virlan / browser-fasttext.js-example Goto Github PK
View Code? Open in Web Editor NEWSample project with webpack to showcase how to use browser-fasttext.js
License: MIT License
Sample project with webpack to showcase how to use browser-fasttext.js
License: MIT License
Dear @av-virlan,
first off, thank you for this repo, it is a really great example and helped me a lot.
I have a problem with the model loading. It blocks and freezes the website despite it being inside a promise.
addOnPostRun( async function(){
const fastText = new FastText();
fastText.loadModel("model.ftz.txt.bin").then(function(model){
window.fastTextModel = model;
resolve();
});
});
Do you know why this causes the freeze?
Yours
tridelt
Dear @av-virlan
if I call the predict() around 350.000x with k=151 like in this code snippet:
const runApp = function() {
initFastText().then(function(){
document.querySelector("#fasttext-loading").style.display = "none";
document.querySelector("#try-it-out").style.display = "block";
document.querySelector("#detect").addEventListener("click", function(){
const inputText = document.querySelector("#inputText").value;
for (let i = 0; i < 10000000; i++) {
window.fastTextModel.predict(inputText,k=151);
if (i%50000===0) {
console.log(i)
}
}
document.querySelector("#detectedLanguage").innerHTML = "Detected language: " + predictions[0].label.substring("__label__".length);
});
});
}
It runs out of memory and throws this error:
Cannot enlarge memory, asked to go up to 2147487744 bytes, but the limit is 2147483648 bytes!
Is there a memory leak?
Would be super happy to hear your opinion.
Yours
Tridelt
Dear @av-virlan,
the example runs without issues on my machine. May I ask how I run this example with a different pre-trained model? No matter what I do, it always runs the default language prediction model.
I would be super grateful for an answer.
Yours
Tridelt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.