Skip to main content

This library contains code for interacting with EASIER.AI platform in Python.

Project description

EASIER SDK

Start to interact with EASIER platform by openning a session with the EasierSDK handler using your MINIO user and password, which are the same as your EASIER credentials if you are using an EASIER official platform.

from easierSDK.easier import EasierSDK
from easierSDK.classes.categories import Categories

easier = EasierSDK(minio_url="minio.easier-ai.eu", minio_user="", minio_password="")  

In EASIER, models and datasets can be identified by their parent repository and their category. You can get an overview of the available repositories that you can interact with by using the following function. It also shows how many models and datasets are available in each repository.

easier.show_available_repos()  

Set the parameter deep to True to get more in-depth information of the content of the repositories: the name of the models and datasets that are inside each repository.

models_list, datasets_list = easier.show_available_repos(deep=True)  

The function also returns a list of the models and datasets available.

print(models_list)
print(datasets_list)

Similarly, you can list the models and datasets by their category. The function behaves as the previous one.

easier.show_categories()
models_list, datasets_list = easier.show_categories(deep=True)  
print(models_list)
print(datasets_list)

EASIER internal APIs: Models and Datasets

The EASIER SDK handles two internal APIs: ModelsAPI and DatasetsAPI. They allow you to interact seamlessly with models and datasets of the platform, respectively.

EASIER Models API

You can get an overview of the available models by using this function. It accepts two parameters: one for the parent repository of the models and one for the category of the models. Remember that there exists an enumerator for the categories to help you in identifying them. It was imported as Categories.

easier.models.show_models()
easier.models.show_models(repo_name="") 
easier.models.show_models(category=Categories.MISC)  
easier.models.show_models(repo_name="", category=Categories.MISC)  

In addition, you can use the following to get more information about a model, which is identified by their parent repository, its category and its name (which is shown as output of the previous function).

easier.models.show_model_info(repo_name="", category=Categories.MISC, model_name="")

Similarly, you can get the information about a specific model version by using its experiment identifier.

easier.models.show_model_info(repo_name="", category=Categories.MISC, model_name="", experimentID=1)

Loading a model

Use this function to load a model directly from the repository. If you don't set the experimentID, the function will load the last version of the model. The function returns a variable of type EasierModel, check the documentation to get more information about this class.

my_easier_model = easier.models.load_from_repository(repo_name="", category=Categories.MISC, model_name="")
# my_easier_model = easier.models.load_from_repository(repo_name="", category=Categories.MISC, model_name="", experimentID=1)

You can print the model's information enclosed in its ModelMetadata variable. Similarly, check the documentation to get more information about this class.

my_easier_model_metadata = my_easier_model.get_metadata()
my_easier_model_metadata.pretty_print()

One important attribute of the ModelMetadata class is the features attribute. If your model was trained using a set of features from tabular data, you are encouraged to save the features as a list on this variable, so that future uses of this model know which features the model was trained with.

print(my_easier_model_metadata.features)

You can also load a model from a local path with this function. Remember that it should follow the EASIER file extension guide for a proper loading of all the objects. Check the documentation to get more information about it.

my_easier_model_2 = easier.models.load_from_local(path="", print_files=True)

Compilating a TF model to TF Lite

EASIER SDK has a specific function to compile your TF model to the TF Lite version. You just need to pass the variable of type Model and some calibration data (as a numpy.array) which was used to train the model.

easier_models.compile_tflite(model=my_easier_model, calibration_data=x)

Upload Model

Once you have finished to work with your model, you can upload it to the EASIER platform. Besides, you have the possibility to make it public for other EASIER users (it will be uploaded to your public repository).

easier.models.upload(category=Categories.MISC, model=my_easier_model, public=False)

EASIER Datasets API

Similar to the Models API, you can get an overview of the available datasets by using this function. It accepts two parameters: one for the parent repository of the datasets and one for the category of the datasets. Remember that there exists an enumerator for the categories to help you in identifying them. It was imported as Categories.

easier.datasets.show_datasets()  
easier.datasets.show_datasets(repo_name="")  
easier.datasets.show_datasets(category=Categories.MISC)  
easier.datasets.show_datasets(repo_name="", category=Categories.MISC)  

In addition, you can use the following function to get more information about a dataset, which is identified by their parent repository, its category and its name (which is shown as output of the previous function).

easier.datasets.show_dataset_info(repo_name="", category=Categories.MISC, dataset_name="")

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easierSDK-0.0.32.tar.gz (16.4 kB view hashes)

Uploaded Source

Built Distribution

easierSDK-0.0.32-py3-none-any.whl (27.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page