ersilia.store package¶
Submodules¶
ersilia.store.api module¶
- class ersilia.store.api.InferenceStoreApi(model_id: str)[source]¶
Bases:
ErsiliaBase
A class to interact with the Inference Store API.
This class provides methods to upload input data to the inference store, request predictions, and retrieve the results. It handles the creation of unique request IDs, obtaining presigned URLs for file uploads, and managing the input data format.
- Parameters:
model_id (str) – The ID of the model for which the inference is being performed.
Examples
api = InferenceStoreApi(model_id="eosxxxx") inputs = ["CCO", "CCN"] api.get_precalculations(inputs)
Mechanism¶
Initialize the class with a model ID.
Generate a unique request ID for each inference request.
Obtain a presigned URL from the inference store for uploading input data.
Adapt the input data to the required format and upload it using the presigned URL.
Request the predictions from the inference store using the request ID.
Retrieve and return the URL of the output predictions.
ersilia.store.utils module¶
- class ersilia.store.utils.InferenceStoreMessage(model_id)[source]¶
Bases:
object
Base class for inference store messages.
- Parameters:
model_id (str) – The ID of the model for which the message is being generated.
- class ersilia.store.utils.ModelNotInStore(model_id)[source]¶
Bases:
InferenceStoreMessage
Message class for models not found in the inference store.
- Parameters:
model_id (str) – The ID of the model that is not found.
- class ersilia.store.utils.OutputSource[source]¶
Bases:
object
Class to define output source options.
- ALL = ['local-only', 'cloud-only']¶
- CLOUD_ONLY = 'cloud-only'¶
- LOCAL_ONLY = 'local-only'¶
- class ersilia.store.utils.PrecalculationsInStore(model_id, output_url)[source]¶
Bases:
InferenceStoreMessage
Message class for precalculations found in the inference store.
- Parameters:
model_id (str) – The ID of the model for which precalculations are found.
output_url (str) – The URL where the precalculations can be downloaded.
- class ersilia.store.utils.PrecalculationsNotInStore(model_id)[source]¶
Bases:
InferenceStoreMessage
Message class for precalculations not found in the inference store.
- Parameters:
model_id (str) – The ID of the model for which precalculations are not found.