-
Notifications
You must be signed in to change notification settings - Fork 791
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
[Question] Using transformers.js inside an Obsidian Plugin #291
Comments
Hi there 👋 - very cool idea! For some of the other build tools (like webpack), you can ignore certain modules (see here for an example). In particular, you'd need to ignore the Alternatively, if you can link to a CDN, you can try https://cdn.jsdelivr.net/npm/@xenova/[email protected] |
cool i'll try those :) |
This doesn't seem to work because Obsidian plugins are actually run inside of node environment |
Oh actually I didn't even notice in the first image, it says it uses electron! I made an electron sample app a few months ago here. It should still work, but let me know if you run into any issues. |
hi @xenova Thanks again for taking the time to answer. I don't think I can use this tutorial. Obsidian plugins are tricky because I don't control the electron bundling process. the constraint that I'm operating under is: I need to provide a single javascript file (and nothing else). this single js file is then interpreted by Obsidian which is an electron app. when require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`); in my case the pwd is: and this won't be able to resolve. it's starting to look more and more like an issue with onnx, so I'll look into this. but if you have any idea i'd be happy to hear it |
Hi @ashgansh I'm also thinking about using it in an Obsidian plugin. Did you figure this out? |
Hello! Any progress on this? @ashgansh @xenova ? |
I am trying to do the same, and I think the best way to go about it is to somehow load onnxruntime-web in the plugin and make use of WebAssembly. I am trying to see if I can force a browser build and make some edits in the library to read/write model files in the vault. Will report when I have made progress. |
sorry guys haven't figured it out. i decided to go for a server-client architecture, currently i allow my users to self-host the server easily (just two comands) and atm focused on OpenAI + Ollama not sure when i will revisit transformer.js for my use case. would still be interested to make it scale my plugin horizontally. |
I have found a way to load Feel free to check this branch: https://github.com/lhr0909/obsidian-plugin-hypersearch/tree/wasm-loading Now that the bundling process is stable, I am going to look into hacking a bit more into the downloading file process now.. Might need to download the model files into the vault separately to be safe. We will see. |
@xenova Currently running into a very strange issue where it is saying that If you install obsidian, you can import the produced plugin ( https://docs.obsidian.md/Plugins/Getting+started/Build+a+plugin Plugin in question: https://github.com/lhr0909/obsidian-plugin-hypersearch/tree/webpack-onnx-worker-error Also a thread in Obsidian forum: https://forum.obsidian.md/t/can-plugins-use-web-worker/81040/6 |
I'm trying to run transfomer.js inside of Obsidian but running into some errors:
This code is triggering the issues:
Link to source
These are the lines that are calling the code above
Context about Obsidian plugins:
In my case, this is my esbuild setup
How should I be tackling this, what would be the recommended way to bundle transformer.js?
The text was updated successfully, but these errors were encountered: