`TypeError: Deno.dlopen is not a function`
Hello,
I am trying to use the sentiment model, but I get an error. This is my code:
const manager = await ModelManager.create();
const sentimentModel = await manager.createSentimentModel();
async function filterTweets(tweets: TwitterResponse) {
const sentiments = await sentimentModel.predict(tweets.data.map(tweet => tweet.text));
return tweets.data.filter((_, index) => {
return sentiments[index].score > 0.7;
});
}
Error
at Module.prepare (https://deno.land/x/[email protected]/plug.ts:77:15)
at async Function.create (https://deno.land/x/[email protected]/model_manager.ts:181:17)
Command
bash deno run -A ./src/tweets.ts --unstable
Hello, I believe the issue is that you passed in the --unstable flag after the file. Can you try running your command again with the --unstable flag after the -A flag?
bash deno run -A --unstable ./src/tweets.ts
I am getting another error now:
Command
deno run -A --unstable ./src/tweets.ts
Error
error: Uncaught (in promise) Error: Could not open library: Could not open library: libtorch_cpu.so: cannot open shared object file: No such file or directory
return Deno.dlopen(file.path, symbols);
^
at new DynamicLibrary (deno:ext/ffi/00_ffi.js:274:39)
at Object.dlopen (deno:ext/ffi/00_ffi.js:368:12)
at Module.prepare (https://deno.land/x/[email protected]/plug.ts:77:15)
at async Function.create (https://deno.land/x/[email protected]/model_manager.ts:181:17)
at async file:///onmax/my-project/src/tweets.ts:25:17
Hmm, I suppose that means that rust-bert dynamically links torch. Sorry, did not know that it did that as I've only ran bertml locally. Can you try install libtorch v1.13.0 from https://pytorch.org/get-started/locally/ ?
Also, these are the full instructions from the rust-bert repo: https://github.com/guillaume-be/rust-bert#manual-installation-recommended