Skip to main content

Nucleus

https://dashboard.scale.com/nucleus

Aggregate metrics in ML are not good enough. To improve production ML, you need to understand their qualitative failure modes, fix them by gathering more data, and curate diverse scenarios.

Scale Nucleus helps you:

  • Visualize your data
  • Curate interesting slices within your dataset
  • Review and manage annotations
  • Measure and debug your model performance

Nucleus is a new way—the right way—to develop ML models, helping us move away from the concept of one dataset and towards a paradigm of collections of scenarios.

Installation

$ pip install scale-nucleus

CLI installation

We recommend installing the CLI via pipx (https://pypa.github.io/pipx/installation/). This makes sure that the CLI does not interfere with you system packages and is accessible from your favorite terminal.

For MacOS:

brew install pipx
pipx ensurepath
pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Otherwise, install via pip (requires pip 19.0 or later):

python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Common issues/FAQ

Outdated Client

Nucleus is iterating rapidly and as a result we do not always perfectly preserve backwards compatibility with older versions of the client. If you run into any unexpected error, it's a good idea to upgrade your version of the client by running

pip install --upgrade scale-nucleus

Usage

For the most up to date documentation, reference: https://dashboard.scale.com/nucleus/docs/api?language=python.

For Developers

Clone from github and install as editable

git clone git@github.com:scaleapi/nucleus-python-client.git
cd nucleus-python-client
pip3 install poetry
poetry install

Please install the pre-commit hooks by running the following command:

poetry run pre-commit install

When releasing a new version please add release notes to the changelog in CHANGELOG.md.

Best practices for testing: (1). Please run pytest from the root directory of the repo, i.e.

poetry run pytest tests/test_dataset.py

(2) To skip slow integration tests that have to wait for an async job to start.

poetry run pytest -n auto -m "not integration"

Note: "-n auto" is used for pytest-xdist parallelization

Pydantic Models

Prefer using Pydantic models rather than creating raw dictionaries or dataclasses to send or receive over the wire as JSONs. Pydantic is created with data validation in mind and provides very clear error messages when it encounters a problem with the payload.

The Pydantic model(s) should mirror the payload to send. To represent a JSON payload that looks like this:

{
  "example_json_with_info": {
    "metadata": {
      "frame": 0
    },
    "reference_id": "frame0",
    "url": "s3://example/scale_nucleus/2021/lidar/0038711321865000.json",
    "type": "pointcloud"
  },
  "example_image_with_info": {
    "metadata": {
      "author": "Picasso"
    },
    "reference_id": "frame0",
    "url": "s3://bucket/0038711321865000.jpg",
    "type": "image"
  }
}

Could be represented as the following structure. Note that the field names map to the JSON keys and the usage of field validators (@validator).

import os.path
from pydantic import BaseModel, validator
from typing import Literal


class JsonWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["pointcloud", "recipe"]

    @validator("url")
    def has_json_extension(cls, v):
        if not v.endswith(".json"):
            raise ValueError(f"Expected '.json' extension got {v}")
        return v


class ImageWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["image", "mask"]

    @validator("url")
    def has_valid_extension(cls, v):
        valid_extensions = {".jpg", ".jpeg", ".png", ".tiff"}
        _, extension = os.path.splitext(v)
        if extension not in valid_extensions:
            raise ValueError(f"Expected extension in {valid_extensions} got {v}")
        return v


class ExampleNestedModel(BaseModel):
    example_json_with_info: JsonWithInfo
    example_image_with_info: ImageWithInfo

# Usage:
import requests
payload = requests.get("/example")
parsed_model = ExampleNestedModel.parse_obj(payload.json())
requests.post("example/post_to", json=parsed_model.dict())

Migrating to Pydantic

  • When migrating an interface from a dictionary use nucleus.pydantic_base.DictCompatibleModel. That allows you to get the benefits of Pydantic but maintaints backwards compatibility with a Python dictionary by delegating __getitem__ to fields.
  • When migrating a frozen dataclass use nucleus.pydantic_base.ImmutableModel. That is a base class set up to be immutable after initialization.

Updating documentation: We use Sphinx to autogenerate our API Reference from docstrings.

To test your local docstring changes, run the following commands from the repository's root directory:

poetry shell
cd docs
sphinx-autobuild . ./_build/html --watch ../nucleus

sphinx-autobuild will spin up a server on localhost (port 8000 by default) that will watch for and automatically rebuild a version of the API reference based on your local docstring changes.

Custom Metrics using Shapely in scale-validate

Certain metrics use Shapely and rasterio which is added as optional dependencies.

pip install scale-nucleus[metrics]

Note that you might need to install a local GEOS package since Shapely doesn't provide binaries bundled with GEOS for every platform.

#Mac OS
brew install geos
# Ubuntu/Debian flavors
apt-get install libgeos-dev

To develop it locally use

poetry install --extras metrics

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scale_nucleus-0.21.2.tar.gz (179.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

scale_nucleus-0.21.2-cp314-cp314-win_amd64.whl (227.7 kB view details)

Uploaded CPython 3.14Windows x86-64

scale_nucleus-0.21.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (241.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

scale_nucleus-0.21.2-cp314-cp314-macosx_11_0_arm64.whl (225.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

scale_nucleus-0.21.2-cp313-cp313-win_amd64.whl (227.8 kB view details)

Uploaded CPython 3.13Windows x86-64

scale_nucleus-0.21.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (241.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

scale_nucleus-0.21.2-cp313-cp313-macosx_11_0_arm64.whl (225.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scale_nucleus-0.21.2-cp312-cp312-win_amd64.whl (227.8 kB view details)

Uploaded CPython 3.12Windows x86-64

scale_nucleus-0.21.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (241.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

scale_nucleus-0.21.2-cp312-cp312-macosx_11_0_arm64.whl (225.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scale_nucleus-0.21.2-cp311-cp311-win_amd64.whl (227.8 kB view details)

Uploaded CPython 3.11Windows x86-64

scale_nucleus-0.21.2-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (241.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

scale_nucleus-0.21.2-cp311-cp311-macosx_11_0_arm64.whl (225.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scale_nucleus-0.21.2-cp310-cp310-win_amd64.whl (227.8 kB view details)

Uploaded CPython 3.10Windows x86-64

scale_nucleus-0.21.2-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (240.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

scale_nucleus-0.21.2-cp310-cp310-macosx_11_0_arm64.whl (225.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file scale_nucleus-0.21.2.tar.gz.

File metadata

  • Download URL: scale_nucleus-0.21.2.tar.gz
  • Upload date:
  • Size: 179.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2.tar.gz
Algorithm Hash digest
SHA256 a4c39a5537ebd1022546c1e09310beb8dc9962282a51c08b1b42f6e9e5721d1d
MD5 7e025464fae6028a0394550ebfe439ec
BLAKE2b-256 94dc608c6955c1ddf68678ddbc34f0ddb1755c64bf83d006538a81c03b69e83d

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: scale_nucleus-0.21.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 227.7 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7964848bef95e78779fac02b5e2b2c4b45d076eebf371a0436900ddf99703f69
MD5 8347d859cba376b5c18181b60ce2fc47
BLAKE2b-256 2c18f781030469956c1ea9839e1eba2fa8e71aee151aefa9c3ae2c7dd09f95b8

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 33484906fd3f7ac2bf4bbf7b458d56f299bb4188d97829a8aba7b0f9864af983
MD5 43e260d013f4325b2467cebece6cbdc1
BLAKE2b-256 129d3f1f284ef5fec1aad2e4d5e5a303ab3624f4134adae5d0c5d68c4f408988

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cdf6b431aab32e5f40e620e6cb2b5331aea4b5f228d1fc3e95376edec55e5d9
MD5 5bba31736cf453b949a22ab4c9aa6760
BLAKE2b-256 71e7fa39e80252de9ad758305c52b7856dd200f470fe8a1cde7d1b825a74409d

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: scale_nucleus-0.21.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 227.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9d1ba661d83311676e4cce64cbdeba3fd48d64849bcb46b91c1801b6d05e99d6
MD5 2a43f2480ea208bd2efbd0453e637603
BLAKE2b-256 000aa662417ed01458122f1ff1e078c7b6ff3a7f2222c5dba45ccc5b407b7856

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 a4d2890b7df3eee3425bf7526972ecefb6ecc95529f492e1a8c48fbbaa08fad3
MD5 b10c61ceddcf7c31f382ce65c5dae403
BLAKE2b-256 43e2cabe9aec1b6c925f88c92f311e18dbb25546207e455269a9c705e1f6a747

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebda69bd492b607a38b46b599d12cd4a7d39627ef404061634372a6cb8479c06
MD5 03252e5036926aff2920c349f64fe298
BLAKE2b-256 bab7a9c85d5dbc14f048b45c744996d0525a2ccdc525fa43f4fd04fd2a2cc217

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: scale_nucleus-0.21.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 227.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f61f1b934b14a3a6fcbccad81a7fe7756b17128c001fff93fe8552b22bc06f8
MD5 a9e63daf5f0a7e30817c74b4a5055137
BLAKE2b-256 b4449891d2f312786d1de230cc5ae8e6b43f4f5ab3c8c570895dcead5a3d29b6

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 5e58edc472521fa0bb1425401b5e784d7077a916dfe5a9d6fc0f93944157dc96
MD5 569edd836fc2025dd52b3e90898d9716
BLAKE2b-256 3f4f99443b1f2d09706b3c583a989c02ec308fab30db33e4a7ab9689deb97d1d

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6eb40c6f26a196a7aa930cc5c2e1af4621447366aee916400deff95baf215b8
MD5 f79661cdbc983286977269439924e3f8
BLAKE2b-256 9ae7dfbb8e0a7e74ebbe1d179b0f95f47146c72594dd28f0ed3bbbd2432a6e5e

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: scale_nucleus-0.21.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 227.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bad6eb70b6b064fdf4661b70bbeb332dad119edeadf4cc857b1fcd2e379dba46
MD5 96beafe564e19bf342ec4ee4280a8351
BLAKE2b-256 5bcc57e5219086f51213b2c204029c8c6398954c90d490605e5e421e8dff02b1

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d7d17a0c633ab8154f8c16cd277824ec971d91a6172a81552a62df5c56476b20
MD5 ec4aa219102ccb0acf41e955bcaf5099
BLAKE2b-256 71e6eb4ff83f3257c2b72f2db4d586085cf1da988c30bda1b6650d8ce507e2ae

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a08ebe172d0afbb19024e166fe000483df8424120ccdaea95c5c8abefb56544
MD5 f447690ee905643869a2420753d3ee09
BLAKE2b-256 fd1d8dbac680fe5a9b5174f0833b268e7bf1574bddfca6f06a3163dcd5ca27b8

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: scale_nucleus-0.21.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 227.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.21 Linux/7.0.0-1009-aws

File hashes

Hashes for scale_nucleus-0.21.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 369b8e25592d8286738f38be802491baef983d10a92030172f6c22cd64c78b89
MD5 e9c3535f4b7f7a7a2a9808b58745bbb4
BLAKE2b-256 c04e7d9c371412de2e0b6ada377010b2453ad622811c93463bebf48b7403c269

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 57a1759a21bb8ab743e358ac24bb5ddd62f0b6cbb38afdc624ebdc7f10b80c83
MD5 36ccf98225cda1149a29a6e1ff890791
BLAKE2b-256 7c284550f2088a8a9635c9afa291dc8a84095f9f3c34238f954c3e07ded0ca04

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.21.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scale_nucleus-0.21.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38b57b92e40d9fe500ea5a839baca6309e1fe890b2e0aeb541d67181fc6535bc
MD5 389646ca88031284536fccba5dabc781
BLAKE2b-256 d55cf2f0a300d23e110d9c447555b33a31329bd6a491c2e08f030b6045f3b5fc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.21.2 This release

16 files

0.20.0

16 files

0.19.0

16 files

0.18.4

2 files

0.18.3

2 files

0.18.1

2 files

0.17.14

2 files

0.17.13

2 files

0.17.12

2 files

0.17.11

2 files

0.17.10

2 files

0.17.9

2 files

0.17.8

2 files

0.17.7

2 files

0.17.6

2 files

0.17.5

2 files

0.17.3

2 files

0.17.2

2 files

0.17.1

2 files

0.17.0

2 files

0.16.18

2 files

0.16.17

2 files

0.16.16

2 files

0.16.15

2 files

0.16.14

2 files

0.16.13

2 files

0.16.12

2 files

0.16.11

2 files

0.16.10

2 files

0.16.8

2 files

0.16.7

2 files

0.16.6

2 files

0.16.5

2 files

0.16.4

2 files

0.16.3

2 files

0.16.2

2 files

0.16.1

2 files

0.15.10

2 files

0.15.8

2 files

0.15.7

2 files

0.15.6

2 files

0.15.5

2 files

0.15.4

2 files

0.15.3

2 files

0.15.2

2 files

0.15.1

2 files

0.15.0

2 files

0.14.29

2 files

0.14.28

2 files

0.14.27

2 files

0.14.26

2 files

0.14.25

2 files

0.14.24

2 files

0.14.23

2 files

0.14.21

2 files

0.14.20

2 files

0.14.17

2 files

0.14.16

2 files

0.14.15

2 files

0.14.14

2 files

0.14.12

2 files

0.14.10

2 files

0.14.9

2 files

0.14.8

2 files

0.14.7

2 files

0.14.5

2 files

0.14.4

2 files

0.14.3

2 files

0.14.2

2 files

0.14.1

2 files

0.14.0

2 files

0.13.4

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.4

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.7

2 files

0.6.6

2 files

0.6.4

2 files

0.6.3

2 files

0.6.1

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.1.25

2 files

0.1.24

2 files

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page