Chromia
Start Building

03 / 15Module 1: Project setupAdvanced

Choose an embedding model

Choose an embedding model before you configure the backend or run any scripts.

The model turns each movie plot summary into a vector of fixed length. That length, the dimension, depends on the model, and you need to set it in your backend.

Clone the repo

If you don't have the project repository locally yet, clone it:

bash
git clone https://bitbucket.org/chromawallet/vector-db-movie-demo.gitcd vector-db-movie-demo

Create your .env file

In the python/ folder, copy the template to create a .env file:

bash
cd pythoncp .env.template .env

You'll edit this file in the next step.

Select your model

Open .env in your editor and uncomment the line for the EMBEDDING_MODEL option you want.

Example:

env
EMBEDDING_MODEL=sentence-transformers/all-mpnet-base-v2

This setting determines which sentence embedding model vectorizes the movie summaries.

You can also use a different model from the Hugging Face Hub, as long as it works with the sentence-transformers library and outputs dense vectors.

Model overview

ModelDimensionsNotes
all-MiniLM-L6-v2384Compact and fast
all-mpnet-base-v2768Balanced; a sensible default
all-roberta-large-v11024Higher quality, slower
intfloat/e5-large-v21024Uses query:/passage: prefixes; strongest for search
BAAI/bge-large-en-v1.51024Alternative with very strong performance

Choosing the right model

Bigger models can produce better semantic matches, but they use more memory and take longer to run.
On a GPU, any model in the table should work without problems.
On a CPU, a smaller model keeps processing from becoming slow.

In the next step, you'll enter the model's dimension when configuring your Rell module in chromia.yml.

Written for this site from Chromia’s public course. Code samples are the course’s own.