-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
embedding: support cybertron local embeddings #494
Comments
corani
added a commit
to corani/langchaingo
that referenced
this issue
Jan 19, 2024
Added a new package 'cybertron' under 'embeddings' to run embedding models locally. This includes the main 'cybertron.go' file, a test file 'cybertron_test.go', and an 'options.go' file for providing various options for the client. Resolves tmc#494
9 tasks
I had some idle time, so I've created a PR for it: #531 |
Very cool! Are you open to writing an example and perhaps a docs site guide? |
corani
added a commit
to corani/langchaingo
that referenced
this issue
Jan 22, 2024
Added a new package 'cybertron' under 'embeddings' to run embedding models locally. This includes the main 'cybertron.go' file, a test file 'cybertron_test.go', and an 'options.go' file for providing various options for the client. Resolves tmc#494
corani
added a commit
to corani/langchaingo
that referenced
this issue
Jan 23, 2024
Added a new package 'cybertron' under 'embeddings' to run embedding models locally. This includes the main 'cybertron.go' file, a test file 'cybertron_test.go', and an 'options.go' file for providing various options for the client. Resolves tmc#494
corani
added a commit
to corani/langchaingo
that referenced
this issue
Jan 23, 2024
1. Updated the .gitignore file to ignore the models generated in the new example directory 'examples/cybertron-embedding-example/models/*'. 2. Added a new example 'cybertron-embedding.go' in 'examples/cybertron-embedding-example' directory. This example demonstrates the usage of embeddings in the context of the 'cybertron' package. 3. Added the necessary go.mod and go.sum files for the new example. The changes provide a practical example of how to use embeddings with the 'cybertron' package. The update to .gitignore prevents the version control system from tracking the unnecessary model files generated by the new example. Resolves tmc#494
9 tasks
haochunchang
pushed a commit
to haochunchang/langchaingo
that referenced
this issue
Jan 23, 2024
Added a new package 'cybertron' under 'embeddings' to run embedding models locally. This includes the main 'cybertron.go' file, a test file 'cybertron_test.go', and an 'options.go' file for providing various options for the client. Resolves tmc#494
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using https://github.com/nlpodyssey/cybertron you can generate embeddings locally in pure Go code. Not all models are supported, but I've successfully tested it with
all-MiniLM-L6-v2
,bge-small-en-v1.5
ande5-small-v2
(alsobase
andlarge
variants, but they get exponentially slower)As this is CPU-based the performance isn't stellar, I'm getting about 20-30 embeddings per second on my laptop. Nevertheless, there are no dependencies on C-code or on CUDA, so it's very easy to get it to work.
Would it make sense to add an adapter for this in langchaingo?
Some sample code:
Cybertron will automatically fetch the model from Huggingface and cache it locally in the
ModelsDir
. The last statement will give you an[]float32
of the embedding.The text was updated successfully, but these errors were encountered: