Urgent.News

What's breaking now, across thousands of outlets.

AI

Making Chroma Work in Chinese

Note : This tutorial picks up where Chroma's official quick start guide leaves off. So you've finished Chroma's quick start — congratulations. Everything works, right up until you feed Chroma some Chinese text. Then it doesn't. Chroma's default embedding model, all-MiniLM-L6-v2 , is English-only. Given Chinese or Japanese input, it embeds it as though the language were noise. You need a model…

This article provides instructions for using Chroma, a vector store, with Chinese language text. By default, Chroma's embedding model, all-MiniLM-L6-v2, is limited to English text, resulting in poor performance when fed Chinese input. There are two primary methods to address this issue: using a locally installed model or an online model hosted on a vendor's server.

For local models, the tutorial recommends BAAI/bge-small-zh-v1.5, a Chinese-specific model that is lightweight and requires less disk space compared to other options. To utilize a local model, one must install the sentence-transformers package and either download the model from huggingface.co or specify a local directory containing the downloaded model.

Online models, on the other hand, involve making API calls to a vendor's server. This method requires an API key and incurs costs based on the number of queries made.

Regardless of the chosen model, the integration with Chroma remains consistent, as it involves setting the embedding_function argument within the client.create_collection() method. The tutorial outlines the steps necessary to set up both local and online models, ensuring compatibility with Chinese language input.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

More from Monday 21 September →