Skip to main content

datatype

superduper.components.datatype

Source code

pickle_decode​

pickle_decode(b: bytes,
info: Optional[Dict] = None) -> Any
ParameterDescription
bThe bytes to decode.
infoOptional information.

Decodes bytes using pickle.

pickle_encode​

pickle_encode(object: Any,
info: Optional[Dict] = None) -> bytes
ParameterDescription
objectThe object to encode.
infoOptional information.

Encodes an object using pickle.

base64_to_bytes​

base64_to_bytes(encoded)
ParameterDescription
encodedThe base64 encoded string.

Decodes a base64 encoded string.

bytes_to_base64​

bytes_to_base64(bytes)
ParameterDescription
bytesThe bytes to convert.

Converts bytes to base64.

dill_decode​

dill_decode(b: bytes,
info: Optional[Dict] = None) -> Any
ParameterDescription
bThe bytes to decode.
infoOptional information.

Decodes bytes using dill.

dill_encode​

dill_encode(object: Any,
info: Optional[Dict] = None) -> bytes
ParameterDescription
objectThe object to encode.
infoOptional information.

Encodes an object using dill.

encode_torch_state_dict​

encode_torch_state_dict(module,
info)
ParameterDescription
moduleModule.
infoInformation.

Encode torch state dictionary.

file_check​

file_check(path: Any,
info: Optional[Dict] = None) -> str
ParameterDescription
pathThe file path to check.
infoOptional information.

Checks if a file path exists.

get_serializer​

get_serializer(identifier: str,
method: str,
encodable: str,
db: Optional[ForwardRef('Datalayer')] = None)
ParameterDescription
identifierThe identifier of the serializer.
methodThe method of the serializer.
encodableThe type of encodable object.
dbThe Datalayer instance.

Get a serializer.

json_decode​

json_decode(b: str,
info: Optional[Dict] = None) -> Any
ParameterDescription
bThe JSON string to decode
infoOptional information

Decode the JSON string to an dict.

json_encode​

json_encode(object: Any,
info: Optional[Dict] = None) -> str
ParameterDescription
objectThe object to encode
infoOptional information

Encode the dict to a JSON string.

torch_decode​

torch_decode(b: bytes,
info: Optional[Dict] = None) -> Any
ParameterDescription
bThe bytes to decode.
infoOptional information.

Decodes bytes to a torch model.

torch_encode​

torch_encode(object: Any,
info: Optional[Dict] = None) -> bytes
ParameterDescription
objectThe object to encode.
infoOptional information.

Saves an object in torch format.

Encoder​

Encoder(self,
identifier: str,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
*,
artifacts: 'dc.InitVar[t.Optional[t.Dict]]' = None,
encoder: Optional[Callable] = None,
decoder: Optional[Callable] = None,
info: Optional[Dict] = None,
shape: Optional[Sequence] = None,
directory: Optional[str] = None,
encodable: str = 'encodable',
bytes_encoding: Optional[str] = <BytesEncoding.BYTES: 'Bytes'>,
intermediate_type: Optional[str] = 'bytes',
media_type: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
artifactsA dictionary of artifacts paths and DataType objects
encoderA callable that converts an encodable object of this encoder to bytes.
decoderA callable that converts bytes to an encodable object of this encoder.
infoAn optional information dictionary.
shapeThe shape of the data.
directoryThe directory to store file types.
encodableThe type of encodable object ('encodable', 'lazy_artifact', or 'file').
bytes_encodingThe encoding type for bytes ('base64' or 'bytes').
intermediate_typeType of the intermediate data [IntermediateType.BYTES, IntermediateType.STRING]
media_typeThe media type.

A data type component that defines how data is encoded and decoded.

Artifact​

Artifact(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Any = <EMPTY>,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xThe artifact object.

Class for representing data to be saved on disk or in the artifact-store.

DecodeTorchStateDict​

DecodeTorchStateDict(self,
cls)
ParameterDescription
clsTorch state cls

Torch state dictionary decoder.

Encodable​

Encodable(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Any = <EMPTY>,
blob: dataclasses.InitVar[typing.Optional[bytearray]] = None,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xThe encodable object.
blobThe blob data.

Class for encoding non-Python datatypes to the database.

File​

File(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Any = <EMPTY>,
file_name: Optional[str] = None,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xpath to the file
file_nameFile name

Data to be saved on disk and passed as a file reference.

LazyArtifact​

LazyArtifact(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Any = <EMPTY>,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xThe artifact object.

Data to be saved and loaded only when needed.

LazyFile​

LazyFile(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Any = <EMPTY>,
file_name: Optional[str] = None,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xpath to the file
file_nameFile name

Class is used to load a file only when needed.

Native​

Native(self,
db: dataclasses.InitVar[typing.Optional[ForwardRef('Datalayer')]] = None,
uuid: str = None,
x: Optional[Any] = None,
*,
identifier: str = '',
file_id: Optional[str] = None,
datatype: superduper.components.datatype.DataType,
uri: Optional[str] = None,
sha1: Optional[str] = None) -> None
ParameterDescription
identifierIdentifier of the leaf.
dbDatalayer instance.
uuidUUID of the leaf.
file_idunique-id of the content
datatypeThe datatype of the content.
uriURI of the content, if any.
sha1SHA1 hash of the content.
xThe encodable object.

Class for representing native data supported by the underlying database.