From 7d71a38f1fd5968649361d136d0a6ce972cdfa38 Mon Sep 17 00:00:00 2001
From: Eric Kaiyuan Chen
Date: Thu, 13 Feb 2025 14:13:22 -0800
Subject: [PATCH 1/3] add vdb
---
README.md | 3 ++-
docs/source/docs/index.rst | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8a3361f9f41..ce3ccac8606 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@
----
:fire: *News* :fire:
+- [Jan 2025] Prepare and Serve Large-Scale Image Search with **Vector Database**: [**blog post**](https://blog.skypilot.co/large-scale-vector-database/) [**example**](./examples/vector_database/)
- [Jan 2025] Launch and Serve **[DeepSeek-R1](https://github.com/deepseek-ai/DeepSeek-R1)** and **[Janus](https://github.com/deepseek-ai/DeepSeek-Janus)** on Kubernetes or Any Cloud: [**R1 example**](./llm/deepseek-r1/) and [**Janus example**](./llm/deepseek-janus/)
- [Oct 2024] :tada: **SkyPilot crossed 1M+ downloads** :tada:: Thank you to our community! [**Twitter/X**](https://x.com/skypilot_org/status/1844770841718067638)
- [Sep 2024] Point, Launch and Serve **Llama 3.2** on Kubernetes or Any Cloud: [**example**](./llm/llama-3_2/)
@@ -187,7 +188,7 @@ Runnable examples:
- [LocalGPT](./llm/localgpt)
- [Falcon](./llm/falcon)
- Add yours here & see more in [`llm/`](./llm)!
-- Framework examples: [PyTorch DDP](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_distributed_torch.yaml), [DeepSpeed](./examples/deepspeed-multinode/sky.yaml), [JAX/Flax on TPU](https://github.com/skypilot-org/skypilot/blob/master/examples/tpu/tpuvm_mnist.yaml), [Stable Diffusion](https://github.com/skypilot-org/skypilot/tree/master/examples/stable_diffusion), [Detectron2](https://github.com/skypilot-org/skypilot/blob/master/examples/detectron2_docker.yaml), [Distributed](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_distributed_tf_app.py) [TensorFlow](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_app_storage.yaml), [Ray Train](examples/distributed_ray_train/ray_train.yaml), [NeMo](https://github.com/skypilot-org/skypilot/blob/master/examples/nemo/), [programmatic grid search](https://github.com/skypilot-org/skypilot/blob/master/examples/huggingface_glue_imdb_grid_search_app.py), [Docker](https://github.com/skypilot-org/skypilot/blob/master/examples/docker/echo_app.yaml), [Cog](https://github.com/skypilot-org/skypilot/blob/master/examples/cog/), [Unsloth](https://github.com/skypilot-org/skypilot/blob/master/examples/unsloth/unsloth.yaml), [Ollama](https://github.com/skypilot-org/skypilot/blob/master/llm/ollama), [llm.c](https://github.com/skypilot-org/skypilot/tree/master/llm/gpt-2), [Airflow](./examples/airflow/training_workflow) and [many more (`examples/`)](./examples).
+- Framework examples: [Vector Database](./examples/vector_database/), [PyTorch DDP](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_distributed_torch.yaml), [DeepSpeed](./examples/deepspeed-multinode/sky.yaml), [JAX/Flax on TPU](https://github.com/skypilot-org/skypilot/blob/master/examples/tpu/tpuvm_mnist.yaml), [Stable Diffusion](https://github.com/skypilot-org/skypilot/tree/master/examples/stable_diffusion), [Detectron2](https://github.com/skypilot-org/skypilot/blob/master/examples/detectron2_docker.yaml), [Distributed](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_distributed_tf_app.py) [TensorFlow](https://github.com/skypilot-org/skypilot/blob/master/examples/resnet_app_storage.yaml), [Ray Train](examples/distributed_ray_train/ray_train.yaml), [NeMo](https://github.com/skypilot-org/skypilot/blob/master/examples/nemo/), [programmatic grid search](https://github.com/skypilot-org/skypilot/blob/master/examples/huggingface_glue_imdb_grid_search_app.py), [Docker](https://github.com/skypilot-org/skypilot/blob/master/examples/docker/echo_app.yaml), [Cog](https://github.com/skypilot-org/skypilot/blob/master/examples/cog/), [Unsloth](https://github.com/skypilot-org/skypilot/blob/master/examples/unsloth/unsloth.yaml), [Ollama](https://github.com/skypilot-org/skypilot/blob/master/llm/ollama), [llm.c](https://github.com/skypilot-org/skypilot/tree/master/llm/gpt-2), [Airflow](./examples/airflow/training_workflow) and [many more (`examples/`)](./examples).
Case Studies and Integrations: [Community Spotlights](https://blog.skypilot.co/community/)
diff --git a/docs/source/docs/index.rst b/docs/source/docs/index.rst
index 2e9ca6859c6..ea5d6c6c18e 100644
--- a/docs/source/docs/index.rst
+++ b/docs/source/docs/index.rst
@@ -108,7 +108,7 @@ Runnable examples:
* `LocalGPT `_
* Add yours here & see more in `llm/ `_!
-* Framework examples: `PyTorch DDP `_, `DeepSpeed `_, `JAX/Flax on TPU `_, `Stable Diffusion `_, `Detectron2 `_, `Distributed `_ `TensorFlow `_, `NeMo `_, `programmatic grid search `_, `Docker `_, `Cog `_, `Unsloth `_, `Ollama `_, `llm.c `__, `Airflow `_ and `many more `_.
+* Framework examples: `Vector Database `_, `PyTorch DDP `_, `DeepSpeed `_, `JAX/Flax on TPU `_, `Stable Diffusion `_, `Detectron2 `_, `Distributed `_ `TensorFlow `_, `NeMo `_, `programmatic grid search `_, `Docker `_, `Cog `_, `Unsloth `_, `Ollama `_, `llm.c `__, `Airflow `_ and `many more `_.
Case Studies and Integrations: `Community Spotlights `_
From 03ff4df4f8fda67f4f4a6c1cc347a7c76eac6e30 Mon Sep 17 00:00:00 2001
From: Eric Kaiyuan Chen
Date: Thu, 13 Feb 2025 14:20:16 -0800
Subject: [PATCH 2/3] add vdb to ai gallery
---
docs/source/_gallery_original/applications/vector_database.md | 1 +
docs/source/_gallery_original/index.rst | 1 +
2 files changed, 2 insertions(+)
create mode 120000 docs/source/_gallery_original/applications/vector_database.md
diff --git a/docs/source/_gallery_original/applications/vector_database.md b/docs/source/_gallery_original/applications/vector_database.md
new file mode 120000
index 00000000000..ebcd50df736
--- /dev/null
+++ b/docs/source/_gallery_original/applications/vector_database.md
@@ -0,0 +1 @@
+../../../../examples/vector_database/README.md
\ No newline at end of file
diff --git a/docs/source/_gallery_original/index.rst b/docs/source/_gallery_original/index.rst
index e049a4ad322..8e0d0b16c35 100644
--- a/docs/source/_gallery_original/index.rst
+++ b/docs/source/_gallery_original/index.rst
@@ -50,6 +50,7 @@ Contents
:maxdepth: 1
:caption: Applications
+ Image Vector Database
Tabby: Coding Assistant
LocalGPT: Chat with PDF
From 03bb266b5b0cdda5d7348267d733d63aadb25374 Mon Sep 17 00:00:00 2001
From: Eric Kaiyuan Chen
Date: Thu, 13 Feb 2025 14:30:15 -0800
Subject: [PATCH 3/3] fix warning
---
examples/vector_database/README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/vector_database/README.md b/examples/vector_database/README.md
index f127d2c176e..20581cc421c 100644
--- a/examples/vector_database/README.md
+++ b/examples/vector_database/README.md
@@ -4,7 +4,7 @@
-### Large-Scale Image Search
+## Large-Scale Image Search
As the volume of image data grows, the need for efficient and powerful search methods becomes critical. Traditional keyword-based or metadata-based search often fails to capture the full semantic meaning in images. A vector database enables semantic search: you can find images that conceptually match a query (e.g., "a photo of a cloud") rather than relying on textual tags.
In particular:
@@ -17,7 +17,7 @@ SkyPilot streamlines the process of running such large-scale jobs in the cloud.
Please find the complete blog post [here](https://blog.skypilot.co/large-scale-vector-database/)
-### Step 0: Set Up The Environment
+## Step 0: Set Up The Environment
Install the following Prerequisites:
* SkyPilot: Make sure you have SkyPilot installed and `sky check` should succeed. Refer to [SkyPilot’s documentation](https://docs.skypilot.co/en/latest/getting-started/installation.html) for instructions.
* Hugging Face Token: To download dataset from Hugging Face Hub, you will need your token. Follow the steps below to configure your token.
@@ -28,7 +28,7 @@ HF_TOKEN=hf_xxxxx
```
or set up the environment variable `HF_TOKEN`.
-### Step 1: Compute Vectors from Image Data with OpenAI CLIP
+## Step 1: Compute Vectors from Image Data with OpenAI CLIP
You need to convert images into vector representations (embeddings) so they can be stored in a vector database. Models like [CLIP by OpenAI](https://openai.com/index/clip/) learn powerful representations that map images and text into the same embedding space. This allows for semantic similarity calculations, making queries like “a photo of a cloud” match relevant images.
Use the following command to launch a job that processes your image dataset and computes the CLIP embeddings:
@@ -51,7 +51,7 @@ You can also use `sky jobs queue` and `sky jobs dashboard` to see the status of
-### Step 2: Construct the Vector Database from Computed Embeddings
+## Step 2: Construct the Vector Database from Computed Embeddings
Once you have the image embeddings, you need a specialized engine to perform rapid similarity searches at scale. In this example, we use [ChromaDB](https://docs.trychroma.com/getting-started) to store and query the embeddings. This step ingests the embeddings from Step 1 into a vector database to enable real-time or near real-time search over millions of vectors.
To construct the database from embeddings:
@@ -68,7 +68,7 @@ Processing batches: 100%|██████████| 1/1 [00:02<00:00, 2.39
Processing files: 100%|██████████| 12/12 [00:05<00:00, 2.04it/s]/1 [00:00, ?it/s]
```
-### Step 3: Serve the Constructed Vector Database
+## Step 3: Serve the Constructed Vector Database
To serve the constructed database, you expose an API endpoint that other applications (or your local client) can call to perform semantic search. Querying allows you to confirm that your database is working and retrieve semantic matches for a given text query. You can integrate this endpoint into larger applications (like an image search engine or recommendation system).