Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Deno.dlopen is not a function #2

Open
onmax opened this issue Nov 3, 2022 · 3 comments
Open

TypeError: Deno.dlopen is not a function #2

onmax opened this issue Nov 3, 2022 · 3 comments

Comments

@onmax
Copy link

onmax commented Nov 3, 2022

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/plug@0.4.1/plug.ts:77:15)
  at async Function.create (https://deno.land/x/bertml@v0.1.0-alpha2/model_manager.ts:181:17)

Command

bash deno run -A ./src/tweets.ts --unstable

@sno2
Copy link
Owner

sno2 commented Nov 3, 2022

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

@onmax
Copy link
Author

onmax commented Nov 9, 2022

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/plug@0.4.1/plug.ts:77:15)
    at async Function.create (https://deno.land/x/bertml@v0.1.0-alpha2/model_manager.ts:181:17)
    at async file:///onmax/my-project/src/tweets.ts:25:17

@sno2
Copy link
Owner

sno2 commented Nov 9, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants