Skip to content

Types

SplitIndicesType module-attribute

SplitIndicesType: TypeAlias = list[int]

A split is defined by a sequence of integers.

SplitType module-attribute

SplitType: TypeAlias = tuple[SplitIndicesType, Union[SplitIndicesType, dict[str, SplitIndicesType]]]

A split is a pair of which the first item is always assumed to be the train set. The second item can either be a single test set or a dictionary with multiple, named test sets.

PredictionsType module-attribute

PredictionsType: TypeAlias = Union[ndarray, dict[str, Union[ndarray, dict[str, ndarray]]]]

A prediction is one of three things:

  • A single array (single-task, single test set)
  • A dictionary of arrays (single-task, multiple test sets)
  • A dictionary of dictionaries of arrays (multi-task, multiple test sets)

DatapointType module-attribute

DatapointType: TypeAlias = tuple[DatapointPartType, DatapointPartType]

A datapoint has:

  • A single input or multiple inputs (either as dict or tuple)
  • No target, a single target or a multiple targets (either as dict or tuple)

SlugStringType module-attribute

SlugStringType: TypeAlias = Annotated[str, StringConstraints(pattern='^[a-z0-9-]+$', min_length=4, max_length=64)]

A URL-compatible string that can serve as slug on the hub.

SlugCompatibleStringType module-attribute

SlugCompatibleStringType: TypeAlias = Annotated[str, StringConstraints(pattern='^[A-Za-z0-9_-]+$', min_length=4, max_length=64)]

A URL-compatible string that can be turned into a slug by the hub.

Can only use alpha-numeric characters, underscores and dashes. The string must be at least 4 and at most 64 characters long.

HubUser module-attribute

HubUser: TypeAlias = SlugCompatibleStringType

A user on the Polaris Hub is identified by a username, which is a SlugCompatibleStringType.

HttpUrlString module-attribute

HttpUrlString: TypeAlias = Annotated[str, BeforeValidator(lambda v: validate_python(v) and v)]

A validated URL that will be turned into a string. This is useful for interactions with httpx and authlib, who have their own URL types.

DirectionType module-attribute

DirectionType: TypeAlias = float | Literal['min', 'max']

The direction of any variable to be sorted. This can be used to sort the metric score, indicate the optmization direction of endpoint.

AccessType module-attribute

AccessType: TypeAlias = Literal['public', 'private']

Type to specify access to a dataset, benchmark or result in the Hub.

TimeoutTypes module-attribute

TimeoutTypes = Union[Tuple[int, int], Literal['timeout', 'never']]

Timeout types for specifying maximum wait times.

IOMode module-attribute

IOMode: TypeAlias = Literal['r', 'r+', 'a', 'w', 'w-']

Type to specify the mode for input/output operations (I/O) when interacting with a file or resource.

SupportedLicenseType module-attribute

SupportedLicenseType: TypeAlias = Literal['CC-BY-4.0', 'CC-BY-SA-4.0', 'CC-BY-NC-4.0', 'CC-BY-NC-SA-4.0', 'CC0-1.0', 'MIT']

Supported license types for dataset uploads to Polaris Hub

ZarrConflictResolution module-attribute

ZarrConflictResolution: TypeAlias = Literal['raise', 'replace', 'skip']

Type to specify which action to take when encountering existing files within a Zarr archive.

HubOwner

Bases: BaseModel

An owner of an artifact on the Polaris Hub

The slug is most important as it is the user-facing part of this data model. The externalId and type are added to be consistent with the model returned by the Polaris Hub .

TargetType

Bases: Enum

The high-level classification of different targets.

TaskType

Bases: Enum

The high-level classification of different tasks.