Files
lancedb/docs/web/integrations/embedding/openclip.mdx
T
Jack Ye b21fb2a4dc docs: bring the open-source documentation into this repository
The pages describing this code lived in lancedb/docs, a repository with ten
stars that neither contributing guide mentioned. A user who hit a wrong page
while reading the source had to find a separate, near-invisible repository to
fix it. These 102 pages now sit beside the code, and a documentation fix is a
pull request in the repository the reader already had open.

`docs/web` is a complete Mintlify site: `cd docs/web && mint dev` serves it with
no other checkout. Enterprise pages stay private and are merged in when the
published site is assembled, so links into them do not resolve here — every
open-source page does.

`docs/web-tests` holds the tests the code examples are extracted from. They ran
against a published wheel before; here they can run against this repository's
own SDK, so an example that stops compiling fails the pull request that broke
it rather than being noticed later.

Both directories sit beside `docs/src` and are invisible to it: mkdocs reads
`docs_dir: src`, so the SDK reference builds and deploys exactly as before.
2026-09-02 21:09:30 -07:00

47 lines
1.7 KiB
Plaintext

---
title: OpenCLIP
sidebarTitle: OpenCLIP
---
import {
PyEmbeddingOpenclipSetup,
PyEmbeddingOpenclipTextSearch,
PyEmbeddingOpenclipImageSearch,
} from '/snippets/integrations.mdx';
We support CLIP model embeddings using the open source alternative, [open-clip](https://github.com/mlfoundations/open_clip) which supports various customizations. It is registered as `open-clip` and supports the following customizations:
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| `name` | `str` | `"ViT-B-32"` | The name of the model. |
| `pretrained` | `str` | `"laion2b_s34b_b79k"` | The name of the pretrained model to load. |
| `device` | `str` | `"cpu"` | The device to run the model on. Can be `"cpu"` or `"gpu"`. |
| `batch_size` | `int` | `64` | The number of images to process in a batch. |
| `normalize` | `bool` | `True` | Whether to normalize the input images before feeding them to the model. |
This embedding function supports ingesting images as both bytes and urls. You can query them using both text and other images.
<Info>
LanceDB supports ingesting images directly from accessible links.
</Info>
<CodeGroup>
<CodeBlock filename="Python" language="Python" icon="python">
{PyEmbeddingOpenclipSetup}
</CodeBlock>
</CodeGroup>
Now we can search using text from both the default vector column and the custom vector column
<CodeGroup>
<CodeBlock filename="Python" language="Python" icon="python">
{PyEmbeddingOpenclipTextSearch}
</CodeBlock>
</CodeGroup>
Because we're using a multimodal embedding function, we can also search using images
<CodeGroup>
<CodeBlock filename="Python" language="Python" icon="python">
{PyEmbeddingOpenclipImageSearch}
</CodeBlock>
</CodeGroup>