File size: 2,346 Bytes
6f845b4
 
 
05a2356
7019c89
 
 
 
 
 
 
 
 
 
 
 
 
2ae6289
 
7019c89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05a2356
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
license: mit
---

# Hydra 3.5 Image Embeddings (e621)

This dataset contains vector embeddings generated by **RedRocket/Hydra 3.5** on over 6.1 million images sourced from e621. 

The dataset includes processed images present in the e621 database dump up to **2026-07-06**. These embeddings contain no raw content from the original images and are entirely safe for all audiences. Math never hurt anyone.

## Dataset Contents

*   **`embeds/`**: The main embeddings stored in `msgpack` format. Files are sliced by post ID using the logic `post_id // 5000` and zero-padded to 5 digits (e.g., `e621_static_00031.hydra35_embed.msgpack`).
*   Other files: Pre-computed indexing data stored in .npy format of a 64-nearest neighbors search (calculated via $L_2$ distance on mean-centered, unit-normalized vectors):
    * `hydra35_embed_postids.npy`: index of post IDs corresponding to the rest of the files, shape (6122692,)
    * `hydra35_embed_ids.npy`: post IDs that are the top 64 nearest neighbors for corresponding post, shape (6122692,64)
    * `hydra35_embed_dists.npy`: distances corresponding to each nearest neighbor, shape (6122692,64)
    * `umap_embeddings.npy`: Pre-computed 2D coordinates for visualization, generated using UMAP (through RAPIDS cuML) using the above KNN search data.
    * `umap_embeddings_3d.npy`: Same as above, except as 3d coordinates.

## Usage & Deserialization

We recommend using the `msgspec` library for fast deserialization of the embeddings. Below is the structured schema and an example of how to load the dataset.
```py
import os
import itertools.count
import msgspec
import numpy as np
import numpy.typing as npt

class E621MetaCatalogFrozen(msgspec.Struct, frozen=True):
    id: int

class E621ImageEmbedding(E621MetaCatalogFrozen, frozen=True, gc=False):
    vector: npt.NDArray[np.float16]

vectors: list[E621ImageEmbedding] = []

for shard_id in itertools.count(start=0):
    file_path = f"embeds/e621_static_{shard_id:05d}.hydra35_embed.msgpack"
    # Stop iterating once we reach the end of the folder's files
    if not os.path.exists(file_path):
        break
        
    with open(file_path, "rb") as f:
        vectors.extend(msgspec.msgpack.decode(f.read(), type=list[E621ImageEmbedding]))
```

<p align="center">
  <img src="e621_embeds_umap.png" width="600" alt="UMAP Topology Map">
</p>