Load into Memory
See original GitHub issueDear @loretoparisi I installed your fasttext.js in order to solve memory problem that we discus about in https://github.com/facebookresearch/fastText/issues/276#issuecomment-337320249
Now when i run : node fasttext_predict.js it take like 5 sec to load the module,
"use strict";
(function() {
var DATA_ROOT='./data';
var FastText = require('./fasttext.js/lib/index');
var fastText = new FastText({
loadModel: DATA_ROOT + '/model_gender.bin' // must specifiy filename and ext
});
var sample="Bashar Al Masri";
fastText.load()
.then(done => {
return fastText.predict(sample);
})
.then(labels=> {
console.log("TEXT:", sample, "\nPREDICT:",labels );
sample="Hisahm al mjude";
return fastText.predict(sample);
})
.then(labels=> {
console.log("TEXT:", sample, "\nPREDICT:",labels );
fastText.unload();
})
.catch(error => {
console.error("predict error",error);
});
}).call(this);
and It return to stdout the prediction and exit , due to fastText.unload();
Now i need to call this file “node fasttext_predict.js
UserName
” from any place passing some args [UserName] to it and return to the stdout the result directly , since you saide it will be loaded into memory , in order to be able to get this result from the php webserver.
It is the same problem with the C++ file loading , i need it to be run in the background !
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
How a program is loaded into memory and then executed?
A program is a pile of bits. A file is a pile of bits. The way a program is loaded into memory is...
Read more >How to efficiently load data to memory | by Jorge C. Leitão
The first section introduces what loading data to memory is composed of; The second and third sections go through each of the components...
Read more >How process loaded into memory? [duplicate] - Super User
A program (or data) can be loaded into memory. A process is started/created to execute that program. A filesystem address is what "point[s]...
Read more >How to load a file into memory? : r/C_Programming - Reddit
Open the file for reading. Open a temporary file for writing in the same directory. Read the first file line by line and...
Read more >In C, Is there a way to load array into memory when need?
I guess this means all tables is loaded to memory right. Yes, that's correct. In your code the tables are global variables.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is working as expected ,
THANK YOU SO MUCH
. You made my day !Can i send you a donation ?
I have added here some benchmarkes therefore I’m closing this issue. Feel free to re-open it if you have any problem.