ersilia.hub.fetch.actions package¶
Submodules¶
ersilia.hub.fetch.actions.check module¶
- class ersilia.hub.fetch.actions.check.ModelChecker(model_id, config_json)[source]¶
Bases:
BaseAction
Checks the model by running an autoservice class.
- Parameters:
model_id (str) – The model identifier.
config_json (dict) – The configuration settings in JSON format.
ersilia.hub.fetch.actions.content module¶
- class ersilia.hub.fetch.actions.content.CardGetter(model_id, config_json)[source]¶
Bases:
BaseAction
Gets the model card and saves it locally.
- Parameters:
model_id (str) – The model identifier.
config_json (dict) – The configuration settings in JSON format.
ersilia.hub.fetch.actions.get module¶
- class ersilia.hub.fetch.actions.get.DockerfileCreator(model_id: str, config_json: dict, commands: list)[source]¶
Bases:
ErsiliaBase
Class to create a Dockerfile for the model.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
commands (list) – List of commands to be added to the Dockerfile.
- class ersilia.hub.fetch.actions.get.ModelGetter(model_id: str, repo_path: str, config_json: dict, force_from_github: bool, force_from_s3: bool)[source]¶
Bases:
BaseAction
Class to get the model repository and parameters.
- Parameters:
model_id (str) – The ID of the model.
repo_path (str) – Path to the local repository.
config_json (dict) – Configuration settings for the model.
force_from_github (bool) – Force download from GitHub.
force_from_s3 (bool) – Force download from S3.
- get(**kwargs)¶
- class ersilia.hub.fetch.actions.get.ModelParametersGetter(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Class to get the model parameters. Getting the checkpoints, weights.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
- get(**kwargs)¶
- class ersilia.hub.fetch.actions.get.ModelRepositoryGetter(model_id: str, config_json: dict, force_from_github: bool, force_from_s3: bool, repo_path: str)[source]¶
Bases:
BaseAction
Class to get the model repository from local, GitHub, or S3.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
force_from_github (bool) – Force download from GitHub.
force_from_s3 (bool) – Force download from S3.
repo_path (str) – Path to the local repository.
- get(**kwargs)¶
- class ersilia.hub.fetch.actions.get.PackCreator(model_id: str, config_json: dict)[source]¶
Bases:
ErsiliaBase
Class to create a pack for the model. The pack.py file loads a model, packs it into a BentoML Service instance, and saves the service for deployment.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
- class ersilia.hub.fetch.actions.get.ServiceCreator(model_id: str, config_json: dict)[source]¶
Bases:
ErsiliaBase
Class to create a service file for the model. The ‘service.py’ specifically facilitates the deployment of a custom model as a BENTOML REST API service.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
- class ersilia.hub.fetch.actions.get.TemplatePreparer(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Class to prepare the template for the model.
In this context, a template refers to a predefined structure or set of files that are necessary for setting up the model environment. This includes configuration files, scripts, and other resources required to deploy and run the model.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
ersilia.hub.fetch.actions.inform module¶
- class ersilia.hub.fetch.actions.inform.ModelInformer(model_id, config_json)[source]¶
Bases:
BaseAction
Class to inform about the model by writing information to a JSON file. Contains detail metadata about the model.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
ersilia.hub.fetch.actions.lake module¶
- class ersilia.hub.fetch.actions.lake.LakeGetter(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Class to fetch data from precalculated data from the DVC repository.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings for the model.
ersilia.hub.fetch.actions.modify module¶
- class ersilia.hub.fetch.actions.modify.ModelModifier(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Modifies model bundles to ensure compatibility and consistency.
Compatibility: Ensures that the model bundle can run in the target environment without issues. Consistency: Ensures that the model bundle follows the same structure and conventions as other bundles.
- Parameters:
model_id (str) – Identifier of the model to be modified.
config_json (dict) – Configuration settings for the modifier.
ersilia.hub.fetch.actions.pack_bentoml module¶
- class ersilia.hub.fetch.actions.pack_bentoml.ModelPacker(model_id: str, mode: str, config_json: dict)[source]¶
Bases:
BaseAction
Packs a model using BentoML.
- Parameters:
model_id (str) – Identifier of the model to be packed.
mode (str) – Packing mode to be used.
config_json (dict) – Configuration settings for the packer.
ersilia.hub.fetch.actions.pack_fastapi module¶
- class ersilia.hub.fetch.actions.pack_fastapi.ModelPacker(model_id: str, mode: str, config_json: dict)[source]¶
Bases:
BaseAction
Packs a model using FastAPI (aka ersilia-pack).
For more information about the ersilia-pack, visit: https://github.com/ersilia-os/ersilia-pack.git
- Parameters:
model_id (str) – Identifier of the model to be packed.
mode (str) – Packing mode to be used.
config_json (dict) – Configuration settings for the packer.
ersilia.hub.fetch.actions.prepare module¶
- class ersilia.hub.fetch.actions.prepare.ModelPreparer(model_id: str, overwrite: bool, config_json: dict)[source]¶
Bases:
BaseAction
Prepares a model for use by deleting existing data if necessary.
- Parameters:
model_id (str) – Identifier of the model to be prepared.
overwrite (bool) – Whether to overwrite existing data.
config_json (dict) – Configuration settings for the preparer.
- prepare()¶
Prepares the model by deleting existing data if necessary.
- prepare(**kwargs)¶
ersilia.hub.fetch.actions.setup module¶
- class ersilia.hub.fetch.actions.setup.SetupChecker(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Checks the setup requirements for the model to be installed and run.
- Parameters:
model_id (str) – Identifier of the model.
config_json (dict) – Configuration settings for the setup checker.
ersilia.hub.fetch.actions.sniff_bentoml module¶
- class ersilia.hub.fetch.actions.sniff_bentoml.BuiltinExampleReader(model_id: str, config_json: dict)[source]¶
Bases:
ErsiliaBase
Reads built-in examples for a BentoML model.
- Parameters:
model_id (str) – Identifier of the model.
config_json (dict) – Configuration settings for the reader.
- class ersilia.hub.fetch.actions.sniff_bentoml.ModelSniffer(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Infers the structure of a model by sniffing its inputs and outputs.
- Parameters:
model_id (str) – Identifier of the model.
config_json (dict) – Configuration settings for the sniffer.
- sniff()¶
Infers the structure of the model.
- sniff(**kwargs)¶
ersilia.hub.fetch.actions.sniff_fastapi module¶
- class ersilia.hub.fetch.actions.sniff_fastapi.BuiltinExampleReader(model_id: str, config_json: dict)[source]¶
Bases:
ErsiliaBase
Reads built-in examples for a FastAPI model.
- Parameters:
model_id (str) – Identifier of the model.
config_json (dict) – Configuration settings for the reader.
- class ersilia.hub.fetch.actions.sniff_fastapi.ModelSniffer(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Infers the structure of a model by sniffing its inputs and outputs.
- Parameters:
model_id (str) – Identifier of the model.
config_json (dict) – Configuration settings for the sniffer.
- sniff()¶
Infers the structure of the model.
- sniff(**kwargs)¶
ersilia.hub.fetch.actions.template_resolver module¶
- class ersilia.hub.fetch.actions.template_resolver.TemplateResolver(model_id: str, repo_path: str | None = None, config_json: dict | None = None)[source]¶
Bases:
BaseAction
Resolves the template type (BentoML or FastAPI) for a model by checking the presence of specific files.
- Parameters:
model_id (str) – Identifier of the model.
repo_path (str, optional) – Path to the local repository, by default None.
config_json (dict, optional) – Configuration settings for the resolver, by default None.
ersilia.hub.fetch.actions.toolize module¶
- class ersilia.hub.fetch.actions.toolize.ModelToolizer(model_id: str, config_json: dict)[source]¶
Bases:
BaseAction
Toolizes a model by distributing it as a Python package or containerizing it using Docker.
- Parameters:
model_id (str) – Identifier of the model to be toolized.
config_json (dict) – Configuration settings for the toolizer.
- toolize(do_pip, do_docker)[source]¶
Toolizes the model by distributing it as a Python package or containerizing it using Docker.
- dockerize(model_id: str)[source]¶
Containerizes the model using BentoML with Docker.
- Parameters:
model_id (str) – Identifier of the model to be containerized.
Module contents¶
- class ersilia.hub.fetch.actions.BaseAction(model_id, config_json, credentials_json)[source]¶
Bases:
ErsiliaBase
Base class for actions.
This class provides common methods for actions.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict) – Configuration settings in JSON format.
credentials_json (dict) – Credentials settings in JSON format.