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.19.0.tar.gz (154.9 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.19.0-cp314-cp314-win_amd64.whl (199.8 kB view details)

Uploaded CPython 3.14Windows x86-64

scale_nucleus-0.19.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (213.8 kB view details)

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

scale_nucleus-0.19.0-cp314-cp314-macosx_11_0_arm64.whl (197.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

scale_nucleus-0.19.0-cp313-cp313-win_amd64.whl (199.9 kB view details)

Uploaded CPython 3.13Windows x86-64

scale_nucleus-0.19.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (213.8 kB view details)

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

scale_nucleus-0.19.0-cp313-cp313-macosx_11_0_arm64.whl (197.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scale_nucleus-0.19.0-cp312-cp312-win_amd64.whl (199.9 kB view details)

Uploaded CPython 3.12Windows x86-64

scale_nucleus-0.19.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (213.7 kB view details)

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

scale_nucleus-0.19.0-cp312-cp312-macosx_11_0_arm64.whl (197.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scale_nucleus-0.19.0-cp311-cp311-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.11Windows x86-64

scale_nucleus-0.19.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (213.3 kB view details)

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

scale_nucleus-0.19.0-cp311-cp311-macosx_11_0_arm64.whl (197.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scale_nucleus-0.19.0-cp310-cp310-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.10Windows x86-64

scale_nucleus-0.19.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (213.0 kB view details)

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

scale_nucleus-0.19.0-cp310-cp310-macosx_11_0_arm64.whl (197.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: scale_nucleus-0.19.0.tar.gz
  • Upload date:
  • Size: 154.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.10.20 Linux/7.0.0-1008-aws

File hashes

Hashes for scale_nucleus-0.19.0.tar.gz
Algorithm Hash digest
SHA256 1b070fd267f31f941ddf6ded81da9f44c81cc5fa60926caa08bb1c5011ba96b7
MD5 480e6a09eb5a35184ace4c021396f2ba
BLAKE2b-256 18618242982d94b003a61c621cdbd1773a9ebe9ec70cb536829dd88f59d1409f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scale_nucleus-0.19.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 69b65dbbc82c25298df65e003c77aaa565c274f0fa971eaf272223b64c3226f2
MD5 b9ff179b95bdbbf77ae457017049a93b
BLAKE2b-256 73f0dcf944dad39575648a69f5e7e6cc5ca4cbde9cf88fd2186e80a4b31e7aed

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.19.0-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.19.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 0a8b73ce06cf19292b51229c2bae75ea4cd3abdbe8697c7446ff0076172dbb29
MD5 5f998e12b7e3dc96660e85d1b04274d7
BLAKE2b-256 37df4dada10fb363d017858f1690c5521d3f37f4100d774d3d9d9e9dcf083e38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scale_nucleus-0.19.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f3312c2cf03f807615e2c403c8a9b2b7f9250e9c619e06b5661e46b022e3c3c
MD5 dee9a8ac7d66210104af4401448613bb
BLAKE2b-256 abca0ea9b3e8edecf446cd558f0871623c7032469a3689eca14d54393ca9d403

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scale_nucleus-0.19.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b3b1029b901d6ff2e5507ca01358e541ba9ce3deef42becc15ab1ce14ea61348
MD5 8981bfae1293f6f0d8f9c5de6d9687c0
BLAKE2b-256 9d2869724b17e4edfc4f5fa99c4f737d44b86c651a87d00b3933497ab5abfbb7

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.19.0-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.19.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 a8ae1ff90d6d044591d89900e477a2780aab65ff976e02363d77d1b82618e6ce
MD5 1053f979424f88e22c30b29b78139687
BLAKE2b-256 0c4b885c38c1771280f60019f688574d7b0802a609b6c8a3bc098205dd751be5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scale_nucleus-0.19.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f33d6ce58dc0f29ffed941447a0f5850b15a18721ab0876996d331107f779684
MD5 d6f0759310cae47d998c980895f8cd86
BLAKE2b-256 307703cdb33f2062f8c5246052d41e178e1fd3b204ea87129c45e8206e780f56

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scale_nucleus-0.19.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9c914b355e7f36640d5882807642740420a4fdb4260a77a5f309d3b47f93a1b9
MD5 274b06f4df0a8f5e2eb6e59f6a813cfa
BLAKE2b-256 55f6d2dbb848d15d9baa93040b46c75b91215ac01d0b985476fef2703d61f29f

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.19.0-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.19.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 37945efde612d75c62a4215274c431771e96e7a02f9ffae3410643e0d3fd83a2
MD5 71e6ddc1c1d7aa0fc7c5100a42835628
BLAKE2b-256 ffc3246882e322b0653d3de11d748a76f00b78c9cebf74ea5f85de314b43a1bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scale_nucleus-0.19.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc626a76b6addc6094ee39d70760f30fc92730cd91ed17e7a502903b044e3e53
MD5 daf86092320735f7b1e954d985bc937c
BLAKE2b-256 51c153c796b0df048c5cea531a7a67e9de030aa49382c71387182a3b0ed63c9c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scale_nucleus-0.19.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 06f48b4c68f48070dd49509eafd57f0651c2ed5b27b5e8056fe59ce535c6f62f
MD5 611c1112c120d235fdcb51b1c57379e2
BLAKE2b-256 d7c0b26acf5eff4f0ed8ef111c952250cdb501e889b842b4c2c7761d7f168958

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.19.0-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.19.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c1f283e276e4c309cd7d9a49a35a6883c9b6f425f5488920d9736b46a7d1758c
MD5 ac6e201890d94a6df90dbc47125c5f61
BLAKE2b-256 5791fa36f6c0f4b3e5e143ecf3a71d3f7cb391ecb16d388e5993370614820e74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scale_nucleus-0.19.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 34464462651e9f52ff5b08b55d38e172936ba230aec8191a53abb4a8d7ae7924
MD5 d3abff56ccc16274f480ec3f51a699d4
BLAKE2b-256 ac11970ec5fa763ff02a0b3739c628623d9d57b729d14b2b87cca629e10c5dd8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scale_nucleus-0.19.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c4d3131783badb7e9165d22d889a422415c08a5a563a88c8518f79e150154f7a
MD5 aa560e3097e88d35f2bd338d92816e28
BLAKE2b-256 5f4f6eb458b1a42acc58f9f0652fc36eefda001c9efcf09d656ea3e2a85e9b50

See more details on using hashes here.

File details

Details for the file scale_nucleus-0.19.0-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.19.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 6765dba7ebda9af153e9de956a9c201e3b3f894bd0b7bfbf869e01abc87880ea
MD5 e16b4841a238e91ae5ba0bab6ccc4554
BLAKE2b-256 eeb2316b76a36aab5b664e1048adbeb5eca0810e637132b01b0b3484da48590e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scale_nucleus-0.19.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01ea0320186b332e3d5855145fad59b9268ad6f53375ddeb5c74e04be6de73f8
MD5 3754035f7cd25efacc8629ff8135da12
BLAKE2b-256 b69f6ad48c32eaf5caa8a0f8a7a621b48608e8e67cee10adff087a8fe87f31c4

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

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