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

Release files for scale-nucleus 0.22.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scale-nucleus 0.22.3
File Size Uploaded
scale_nucleus-0.22.3.tar.gz 182.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for scale-nucleus 0.22.3
File
scale_nucleus-0.22.3-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
scale_nucleus-0.22.3-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
scale_nucleus-0.22.3-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
scale_nucleus-0.22.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
scale_nucleus-0.22.3-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
scale_nucleus-0.22.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
scale_nucleus-0.22.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
scale_nucleus-0.22.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
scale_nucleus-0.22.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
scale_nucleus-0.22.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
scale_nucleus-0.22.3-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
scale_nucleus-0.22.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
scale_nucleus-0.22.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
scale_nucleus-0.22.3-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
scale_nucleus-0.22.3-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 3.7 MB

Release files / scale_nucleus-0.22.3.tar.gz

Download URL scale_nucleus-0.22.3.tar.gz
Size 182.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f07097c057b21131e15b67c5a1848b029b15d377137027a0db984b357aab9e9b
BLAKE2b-256 checksum
How to use checksums
e935da68b2dfe3ea5913919c4958c751d92c254603318d8c6314ce7e38564328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp314-cp314-win_amd64.whl

Download URL scale_nucleus-0.22.3-cp314-cp314-win_amd64.whl
Size 231.3 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
386002e26a75104c61a159e9dbe4fc404dfbf5d1a2cccd25124e3ceaec7e55a0
BLAKE2b-256 checksum
How to use checksums
336665378fe4e7ac0abdb10e0acd3073cdbf6e24c0d92c2e4d03f109e64f7a21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.22.3-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.0 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
2451ee599a67fbfb05d291f6db59323f00f68b313f95521c2451bddfe710fafd
BLAKE2b-256 checksum
How to use checksums
131087223c67891e276a6b5265cdfec74107022d9b653bd3e5ceb7ea9ebe9bf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp314-cp314-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.22.3-cp314-cp314-macosx_11_0_arm64.whl
Size 228.6 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
087e3260a41098a3441828352f1715246eba6f10901493b5be1165475d2eb821
BLAKE2b-256 checksum
How to use checksums
429bc33b690dda859f7aac28254ae2b8ff20df1cca624ae15f5636e33a476173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp313-cp313-win_amd64.whl

Download URL scale_nucleus-0.22.3-cp313-cp313-win_amd64.whl
Size 231.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
8f6fcc04cedbe546d1966a987ba8ccfdc093f39287a8e1919be40eb3c711aadd
BLAKE2b-256 checksum
How to use checksums
2a5780f7b9778c5adb45c9444df9c0cb517d55354ae32defcaddc9b2dcf71253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.22.3-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.0 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
86ba4241f42b3e6677dd03c08cd9514625705f6f14499679177f277cff41188a
BLAKE2b-256 checksum
How to use checksums
c2abe9b350fb8989a701af91c81605768d691f8dbbcb50906b5e453f7b86902f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.22.3-cp313-cp313-macosx_11_0_arm64.whl
Size 228.6 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7c82ed49cfaff9f31403ae2c2d3c9343fd5b7c37444e27dbf528c245a7d17e32
BLAKE2b-256 checksum
How to use checksums
cc2157c9ac8211a16098e0679a1619aec78c4a50ad8af8ab66acff4e86c0a3e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp312-cp312-win_amd64.whl

Download URL scale_nucleus-0.22.3-cp312-cp312-win_amd64.whl
Size 231.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
b6dde75599c0ec352d49f5f567f2e264651257c09a6131ad0b520af7db25f756
BLAKE2b-256 checksum
How to use checksums
ec22d2098096f39865396c5e844cdc2fc794d802684ec7ea80f84bcf0ab709e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.22.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 244.9 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
65101fc00c1ff308917c427a0b1a77c9d58813da0d249879ab33382ac252c003
BLAKE2b-256 checksum
How to use checksums
32f152d9705a792aa3e66b6733a70c04db10e5f765f39f54a490d9d10538c82e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.22.3-cp312-cp312-macosx_11_0_arm64.whl
Size 228.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a887589d20dd0e40f2ea06b273872d7c35283c02c79a481ffe57ed79f3a312bd
BLAKE2b-256 checksum
How to use checksums
6daab49c470b82c92f170a5867b0cab568d247ea0c1e1ac9d41c9614b0f4e8e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp311-cp311-win_amd64.whl

Download URL scale_nucleus-0.22.3-cp311-cp311-win_amd64.whl
Size 231.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
596bcf010304adba9d5e46b9b7526e710c81b0278ffde90126ce392ef260ce6d
BLAKE2b-256 checksum
How to use checksums
b4f479e97945a139a07457b2cac127a19271a095be2e75dc751e4084d400fea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.22.3-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 244.6 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
d4a61a9db8a5a1b22c811971916c717416c3d02df3ee3cc421555db48ed4ed56
BLAKE2b-256 checksum
How to use checksums
9114c3e46fd9de8eb7ddf49c34d602782170c840dea9d83351b3fbe332657dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.22.3-cp311-cp311-macosx_11_0_arm64.whl
Size 228.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3c7de4f8a3ca01bb20501f70b4c308fee3bcde9e2de59e6317746cde3df17ed8
BLAKE2b-256 checksum
How to use checksums
ddc889b3aadfcffad86d94d071bae2bbffc02bb6a0701109747a243db59fff0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp310-cp310-win_amd64.whl

Download URL scale_nucleus-0.22.3-cp310-cp310-win_amd64.whl
Size 231.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
07d84c4f27ee2a63c6b54747974b6c168b7a2b60c4b23fc8d4435afbf1f2d61b
BLAKE2b-256 checksum
How to use checksums
e6e7a7c5aee2b36981b32c420f3858a28158996081357afbc971ae2af8a2c233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.22.3-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 244.3 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
eaeff3112803a4af3aec79589ea0382e70e3100eeb0959adbb593960b3a28f26
BLAKE2b-256 checksum
How to use checksums
214f876fecdbf56e1f26b721a14abb92d37cf15c1c8ad586922f41ca5b9e73fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release files / scale_nucleus-0.22.3-cp310-cp310-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.22.3-cp310-cp310-macosx_11_0_arm64.whl
Size 228.6 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a27e3065266bde1f491511b90648611db3f9bf83f44bfa44dacb85c1adb93aca
BLAKE2b-256 checksum
How to use checksums
f2fa4c1a5170c9751cda235817c7a142e02b03771b1babefc5b98ff2813aee34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.10.21 Linux/7.0.0-1012-aws

Release history Release notifications | RSS feed

This release

0.22.3 This release

16 release files

0.18.3

2 release files

0.17.9

2 release files

0.17.5

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.16.8

2 release files

0.16.5

2 release files

0.16.4

2 release files

0.16.3

2 release files

0.16.1

2 release files

0.15.8

2 release files

0.15.7

2 release files

0.15.5

2 release files

0.15.4

2 release files

0.15.3

2 release files

0.15.2

2 release files

0.15.1

2 release files

0.14.9

2 release files

0.14.8

2 release files

0.14.3

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.3

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.17

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page