netzhang's picture
WIP: Add dataset card with DuckDB query examples (demo only)
57b8204 verified
metadata
dataset_info:
  - config_name: bioclip-2_float16
    features:
      - name: uuid
        dtype: string
      - name: kingdom
        dtype: string
      - name: phylum
        dtype: string
      - name: class
        dtype: string
      - name: order
        dtype: string
      - name: family
        dtype: string
      - name: genus
        dtype: string
      - name: species
        dtype: string
      - name: img_type
        dtype: string
      - name: basisOfRecord
        dtype: string
      - name: publisher
        dtype: string
      - name: identifier
        dtype: string
      - name: emb
        sequence: float16
        length: 768
    splits:
      - name: train
        num_examples: 239580103
configs:
  - config_name: bioclip-2_float16
    data_files:
      - split: train
        path: bioclip-2_float16/*.parquet
license: mit

TreeOfLife-200M Embeddings

Work in progress — this dataset card is under active development.

239 million BioCLIP 2 embeddings (768-dim, float16) for TreeOfLife-200M images, sorted by taxonomic hierarchy. We recommend using DuckDB to access this dataset.

Query Remotely

Query directly from HuggingFace without downloading anything. DuckDB uses Parquet page indexes to skip irrelevant files, making filtered queries fast over the network.

order and class are SQL reserved words — always quote them as "order" and "class".

Python

import duckdb

con = duckdb.connect()
# Authenticate for higher rate limits (recommended)
con.execute("CREATE SECRET (TYPE HUGGINGFACE, TOKEN 'hf_...')")

glob = "hf://datasets/imageomics/TreeOfLife-200M-Embeddings/bioclip-2_float16/*.parquet"

# Get all embeddings for a species
df = con.sql(f"""
    SELECT uuid, emb
    FROM read_parquet('{glob}')
    WHERE species = 'Danaus plexippus'
""").df()

# Count by taxonomic order
con.sql(f"""
    SELECT "order", COUNT(*) as n
    FROM read_parquet('{glob}')
    WHERE "order" IS NOT NULL
    GROUP BY "order"
    ORDER BY n DESC
    LIMIT 10
""").show()

# Filter by family
con.sql(f"""
    SELECT genus, species, COUNT(*) as n
    FROM read_parquet('{glob}')
    WHERE family = 'Felidae'
    GROUP BY genus, species
    ORDER BY n DESC
    LIMIT 10
""").show()

CLI

# Install DuckDB: https://duckdb.org/docs/installation
# Then query directly from the command line:

duckdb -c "
    SELECT species, COUNT(*) as n
    FROM read_parquet('hf://datasets/imageomics/TreeOfLife-200M-Embeddings/bioclip-2_float16/*.parquet')
    WHERE family = 'Nymphalidae'
    GROUP BY species
    ORDER BY n DESC
    LIMIT 10;
"

Download a Taxonomic Slice

Instead of downloading the full 331 GB dataset, extract only the taxa you need. The sorted data and page indexes ensure only the relevant row groups are fetched over the network.

Python

import duckdb

con = duckdb.connect()
con.execute("CREATE SECRET (TYPE HUGGINGFACE, TOKEN 'hf_...')")

glob = "hf://datasets/imageomics/TreeOfLife-200M-Embeddings/bioclip-2_float16/*.parquet"

# Save a single family to a local file
con.sql(f"""
    COPY (
        SELECT * FROM read_parquet('{glob}')
        WHERE family = 'Felidae'
    ) TO 'felidae.parquet'
""")

# Now query locally — instant
con.sql("SELECT species, COUNT(*) as n FROM 'felidae.parquet' GROUP BY species ORDER BY n DESC").show()

CLI

duckdb -c "
    COPY (
        SELECT * FROM read_parquet('hf://datasets/imageomics/TreeOfLife-200M-Embeddings/bioclip-2_float16/*.parquet')
        WHERE \"order\" = 'Primates'
    ) TO 'primates.parquet';
"
Slice Example Rows Size Time
Species: Danaus plexippus 299,874 913 MB ~1 min*
Family: Felidae 149,890 457 MB ~1 min*
Order: Primates 160,307 489 MB ~1 min*

*First query in a session includes a one-time ~3 min glob resolution overhead: DuckDB expands the *.parquet wildcard by making HTTP requests to HuggingFace to discover all 685 filenames. Subsequent queries in the same session reuse the cached file list.

Download Everything

For full-dataset analytics, download all files first.

huggingface-cli download imageomics/TreeOfLife-200M-Embeddings \
  --repo-type dataset --include "bioclip-2_float16/*" --local-dir ./data
duckdb -c "
    SELECT \"order\", COUNT(*) as n
    FROM read_parquet('./data/bioclip-2_float16/*.parquet')
    WHERE \"order\" IS NOT NULL
    GROUP BY \"order\"
    ORDER BY n DESC
    LIMIT 10;
"

Schema

Column Type Description
uuid string Unique image identifier
kingdom string Taxonomic kingdom
phylum string Taxonomic phylum
class string Taxonomic class
order string Taxonomic order
family string Taxonomic family
genus string Taxonomic genus
species string Taxonomic species
img_type string Image source type
basisOfRecord string Basis of record
publisher string Data publisher
identifier string Source URI
emb fixed_size_list<float16>[768] BioCLIP 2 embedding

Data Organization

  • Sort order: kingdom > phylum > class > order > family > genus > species
  • Row groups: 50,000 rows each with column statistics and page indexes
  • Compression: ZSTD level 3
  • Precision: float16 (lossless cosine similarity vs float32 source)

Configs

Config Model Precision Files Size Rows
bioclip-2_float16 BioCLIP 2 float16 685 331 GB 239,580,103