Closed abgupta99 closed 1 year ago
@abgupta99 Thank you for the issue, I will try to reproduce and fix it
This seems identical to the issue I have with HNSWlib-node. It might be coincidental, but in case this is a langchainjs issue, not faiss, see:
https://github.com/hwchase17/langchainjs/issues/943 https://github.com/hwchase17/langchainjs/issues/1764
Spent the day building test cases for this, and it's the same langchainjs error.
Most approaches end up with:
"Could not import faiss-node. Please install faiss-node as a dependency with, e.g. npm install -S faiss-node
.\n\nError: libgomp.so.1: cannot open shared object file: No such file or directory"
Currently I see that there is any route to using langchain with either faiss or hnswnlib on AWS Lambda.
Having similar problem when deployed on Vercel, while on local dev is working fine
Could not import faiss-node. Please install faiss-node as a dependency with, e.g.
npm install -S faiss-node
.\n\nError: libgomp.so.1: cannot open shared object file: No such file or directory","stack":"
I have create a build for AWS Lambda in https://github.com/ewfian/faiss-node/pull/30
And is was works on my side:
It has not been released yet, but you can try the version I built manually below: faiss-node-v0.2.2-aws-x64.zip
For other projects, please replace with the files under the path below:
faiss-node-v0.2.2-aws-x64.zip/node_modules/faiss-node/build/Release
Hi,
No luck my side I’m afraid: still missing libgomp.so.1:
{
"errorType": "Error",
"errorMessage": "Could not import faiss-node. Please install faiss-node as a dependency with, e.g. `npm install -S faiss-node`.\n\nError: libgomp.so.1: cannot open shared object file: No such file or directory",
"trace": [
"Error: Could not import faiss-node. Please install faiss-node as a dependency with, e.g. `npm install -S faiss-node`.",
"",
"Error: libgomp.so.1: cannot open shared object file: No such file or directory",
" at FaissStore.importFaiss (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:237:19)",
" at async readIndex (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:141:37)",
" at async Promise.all (index 1)",
" at async FaissStore.load (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:144:51)",
" at async query (/var/task/index.js:112:20)",
" at async exports.handler (/var/task/index.js:20:9)"
]
}
Also, after adding the Faiss layer I can't add anything much else as it's far too big:
Layers consume more than the available size of 262144000 bytes
David
@dmb0058 I want to know whether it works properly if you directly upload the zip(faiss-node-v0.2.2-aws-x64.zip) I provided above to AWS.
Please confirm that you have replaced the files(node_modules/faiss-node/build/Release) in my zip above to the zip you finally want to upload to AWS.
I also made a demo for langchain here: https://github.com/hwchase17/langchainjs/issues/1930#issuecomment-1646500643 You can try to upload this demo directly to AWS.
Yes, the demo zip (faiss-node-v0.2.2-aws-x64.zip) runs when I upload it as a lambda and gives the same results as you show above.
I can't create a layer though, so can't use this in practice:
aws lambda publish-layer-version --layer-name my-faiss-layer \
--description "My Faiss layer" \
--license-info "MIT" \
--zip-file fileb://my-faiss-node.zip \
--compatible-runtimes nodejs18.x \
--compatible-architectures "x86_64"
An error occurred (RequestEntityTooLargeException) when calling the PublishLayerVersion operation: Request must be smaller than 70167211 bytes for the PublishLayerVersion operation
@dmb0058 Can you reduce the size of the zip to make it meet the limit first. The prebuilt binaries is too large under Linux was also mentioned in your previous issue(https://github.com/ewfian/faiss-node/issues/26). The binaries for AWS have shrunk a lot. The zip containing faiss-node is only 7.5MB. And the zip containing langchain and faiss-node has 15.5MB. Which is far less than the limit of AWS. Please identify what content takes up space and try to reduce it.
That sounds really good. Let me see if I can strip some of the other modules in the application.
On Sat, 22 Jul 2023, 16:10 Fan, @.***> wrote:
@dmb0058 https://github.com/dmb0058 Can you reduce the size of the zip to make it meet the limit first. The prebuilt binaries is too large under Linux was also mentioned in your previous issue(#26 https://github.com/ewfian/faiss-node/issues/26). The binaries for AWS have shrunk a lot. The zip containing faiss-node is only 7.5MB. And the zip containing langchain and faiss-node has 15.5MB. Which is far less than the limit of AWS. Please identify what content takes up space and try to reduce it.
— Reply to this email directly, view it on GitHub https://github.com/ewfian/faiss-node/issues/25#issuecomment-1646603955, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDXCQKCC5FK5EWNK5PSMC3XRPUN7ANCNFSM6AAAAAA2B4CLBY . You are receiving this because you were mentioned.Message ID: @.***>
@dmb0058 You can also try this demo https://github.com/hwchase17/langchainjs/issues/1930#issuecomment-1646994780
The new version was released, To use faiss-node in AWS, you can download faiss-node-vX.X.X-aws-x64.zip
from release. and upload to AWS as a layer.
BTW. if you are using the faiss-node as layer, do NOT install faiss-node as npm package in your AWS Function, see the demo here: https://github.com/hwchase17/langchainjs/issues/1930#issuecomment-1646994780
This now works flawlessly with Fly.io, I had made a cool demo before and now I don't need to copy the zip folder over.
Thank you for maintaining and improving this 🙏🏻
@ewfian
I'm happy to pay you one time 30$ as the best I can for now. Can you share a buymeacoffee/paypal/stripe link? Thanks!
This is totally out of my respect for your work.
The newer version is still cannot get through on the lambda layers, still having the same error which is
{
"errorType": "Error",
"errorMessage": "Could not import faiss-node. Please install faiss-node as a dependency with, e.g. npm install -S faiss-node
.\n\nError: libgomp.so.1: cannot open shared object file: No such file or directory",
"trace": [
"Error: Could not import faiss-node. Please install faiss-node as a dependency with, e.g. npm install -S faiss-node
.",
"",
"Error: libgomp.so.1: cannot open shared object file: No such file or directory",
" at FaissStore.importFaiss (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:237:19)",
" at async readIndex (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:141:37)",
" at async Promise.all (index 1)",
" at async FaissStore.load (/opt/nodejs/node_modules/langchain/dist/vectorstores/faiss.cjs:144:51)",
" at async query (/var/task/index.js:112:20)",
" at async exports.handler (/var/task/index.js:20:9)"
]
}
Describe the bug A clear and concise description of what the bug is.
Environment:
To Reproduce Steps to reproduce the behavior:
Expected behavior should be run succesfully and store text in form of vector store
Screenshots "errorType": "Error", "errorMessage": "Could not import faiss-node. Please install faiss-node as a dependency with, e.g.
npm install -S faiss-node
and make sure you havelibomp
installed in your path.\n\nError: /opt/nodejs/node18/node_modules/faiss-node/build/Release/faiss-node.node: cannot open shared object file: No such file or directory", "trace": [ "Error: Could not import faiss-node. Please install faiss-node as a dependency with, e.g.npm install -S faiss-node
and make sure you havelibomp
installed in your path.", "", "Error: /opt/nodejs/node18/node_modules/faiss-node/build/Release/faiss-node.node: cannot open shared object file: No such file or directory", " at FaissStore.importFaiss (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:207:19)", " at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", " at async FaissStore.addVectors (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:60:37)", " at async FaissStore.fromDocuments (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:197:9)", " at async Runtime.handler (file:///var/task/index.mjs:57:19)" ] }.