Giter VIP home page Giter VIP logo

browser-fasttext.js-example's People

Contributors

av-virlan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

browser-fasttext.js-example's Issues

loading Model blocks

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

Cannot Enlarge Memory Error

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

Load Custom Model

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

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.