Asset#
lit.sdk.data.asset
#
This module provides a set of classes and functions for managing and interacting with data assets in the LIT platform.
__doc__ = '\nThis module provides a set of classes and functions for managing and interacting with data assets in the LIT platform.\n'
module
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__file__ = '/opt/lit-platform/lit-lib/src/lit/sdk/data/asset.cpython-312-x86_64-linux-gnu.so'
module
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__name__ = 'lit.sdk.data.asset'
module
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__package__ = 'lit.sdk.data'
module
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__test__ = {'Asset.files (line 53)': '\n Retrieves individual data files from the asset.\n\n Returns:\n (list[PaAssetFileth]): A list asset file objects.\n\n Examples:\n >>> asset = Asset("contoso", "schema_1707673805399")\n >>> asset.files\n [Path(\'/data/contoso/assets/schema_1707673805399/schema_1707673805399_test.h5\'), Path(\'/data/contoso/assets/schema_1707673805399/schema_1707673805399_train_0.h5\')]\n ', 'get_asset_names (line 112)': '\n Gets all of the training datasets for a given team.\n\n Args:\n team (str): The name of the team.\n\n Returns:\n (list[str]): A list of asset objects.\n\n Examples:\n >>> get_assets("contoso")\n [\'schema_1707673805399\']\n ', 'get_assets (line 131)': '\n Gets all of the training datasets for a given team.\n\n Args:\n team (str): The name of the team.\n\n Returns:\n (list[Asset]): A list of asset objects.\n\n Examples:\n >>> get_assets("contoso")\n [Asset(team=\'contoso\', name=\'schema_1707673805399\')]\n ', 'list_open_assets (line 150)': '\n Lists all assets currently in use by experiments.\n\n Args:\n team (str): The name of the team.\n\n Returns:\n (list[Path]): A list of paths.\n\n Examples:\n >>> list_open_assets("contoso")\n [Path(\'/data/contoso/assets/schema_1707673805399/schema_1707673805399_test.h5\'), Path(\'/data/contoso/assets/schema_1707673805399/schema_1707673805399_train_0.h5\')]\n '}
module
#
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Asset
#
The data file prepared and optimized for training a neural network. The result of the data build process.
Examples:
>>> asset = Asset("contoso", "schema_1707673805399")
>>> len(asset)
11648
>>> asset.datasets
['100_1_min', 'per_min', 'rr_atr_2_2_1800']
__annotations__ = {'team': 'str', 'name': 'str', 'path': 'Path', 'datasets': 'list[str]'}
class
#
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
__doc__ = '\n The data file prepared and optimized for training a neural network. The result of the data build process.\n\n Examples:\n >>> asset = Asset("contoso", "schema_1707673805399")\n >>> len(asset)\n 11648\n >>> asset.datasets\n [\'100_1_min\', \'per_min\', \'rr_atr_2_2_1800\']\n '
class
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__ = 'lit.sdk.data.asset'
class
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__weakref__
property
#
list of weak references to the object
files
property
#
Retrieves individual data files from the asset.
Returns:
| Type | Description |
|---|---|
list[PaAssetFileth]
|
A list asset file objects. |
Examples:
__init__(team, name)
method descriptor
#
Initializes a new instance of Asset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team
|
str
|
The team which owns the Asset. |
required |
name
|
str
|
The name of the Asset. |
required |
__len__()
method descriptor
#
Total number of unique data samples in the test/train dataset.
AssetFile
#
__module__ = 'lit.sdk.data.asset'
class
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__weakref__
property
#
list of weak references to the object
LitDataError
#
Bases: lit.sdk.errors.LitError
A custom exception class for Lit data errors.
__annotations__ = {}
class
#
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
__doc__ = 'A custom exception class for Lit data errors.'
class
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__ = 'lit.sdk.errors'
class
#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__init__(*args, code=None)
method descriptor
#
Initializes a new instance of LitDataError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
object
|
Variable number of arguments to pass to the base class constructor. |
required |
code
|
int | None
|
The error code. Defaults to None. |
None
|
lit_error_handler(error_type=LitError)
method descriptor
#
A decorator function that catches and re-raises exceptions with a custom error type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error_type
|
Type[LitError]
|
The type of exception to raise. Defaults to LitError. |
LitError
|
Returns:
| Type | Description |
|---|---|
Callable
|
A wrapper function that catches exceptions and raises the specified error type. |
Examples:
>>> @lit_error_handler()
... def raises_error():
... assert False
...
>>> raises_error()
Traceback (most recent call last):
File "/opt/lit/src/lit/sdk/errors.py", line 130, in wrapper
File "<stdin>", line 3, in raises_error
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/lit/src/lit/sdk/errors.py", line 132, in wrapper
lit.sdk.errors.LitError: An error occurred in function 'raises_error'