How to compute vector embeddings for a text dataset on a GPU.
mo.stop
function and check if the run_form.value
is None
.
sentence_transformers
library to compute the embeddings with the default model as BAAI/bge-large-en-v1.5
. Find more information about the model here.
title
column, but you can compute the embeddings for any text column in the dataset. The embeddings will now be in the result_df
data frame in a new column called embedding
.
mo.status.progress_bar
is used to show a progress bar in the UI as we compute the embeddings.
cosine_similarity
from sklearn
to build a simple nearest neighbor search.
embedding_similarity
function to search for the nearest neighbors of a query.