ersilia.cli.commands package¶
Subpackages¶
Submodules¶
ersilia.cli.commands.catalog module¶
- ersilia.cli.commands.catalog.catalog_cmd()[source]¶
Creates the catalog command for the CLI.
This command allows users to list a catalog of models available either locally or in the model hub. It provides options to display the catalog in various formats(such as tables by default or json), show more detailed information, and view model cards for specific models.
- Returns:
The catalog command function to be used by the CLI and for testing in the pytest.
- Return type:
function
Examples
Display model card for a specific model ID and show catalog in json format: $ ersilia catalog –card <model_id> –as-json
ersilia.cli.commands.close module¶
- ersilia.cli.commands.close.close_cmd()[source]¶
Closes the current session of the served model.
This command allows users to close the current session and clean up any resources.
- Returns:
The close command function to be used by the CLI and for testing in the pytest.
- Return type:
function
Examples
Close the current session: $ ersilia close
ersilia.cli.commands.delete module¶
- ersilia.cli.commands.delete.delete_cmd()[source]¶
Deletes a specified model.
This command allows users to delete a specified model from the local storage.
- Returns:
The delete command function to be used by the CLI and for testing in the pytest.
- Return type:
function
Examples
Delete a specific model: $ ersilia delete <model_id> Delete all models: $ ersilia delete --all
ersilia.cli.commands.example module¶
ersilia.cli.commands.fetch module¶
- ersilia.cli.commands.fetch.fetch_cmd()[source]¶
Fetches a specified model.
This command allows users to fetch a specified model from the model hub (dockerhub, repo, s3 etc…).
- Returns:
The fetch command function to be used by the CLI and for testing in the pytest.
- Return type:
function
Examples
Fetch a model by its ID: $ ersilia fetch <model_id> [auto model source decider] or ersilia fetch <model_id> --from_github/--from_dockerhub Fetch a model from a local directory: $ ersilia fetch <model_id> --from_dir <path>
ersilia.cli.commands.info module¶
ersilia.cli.commands.publish module¶
ersilia.cli.commands.run module¶
- ersilia.cli.commands.run.run_cmd()[source]¶
Runs a specified model.
This command allows users to run a specified model with given inputs.
- Returns:
The run command function to be used by the CLI and for testing in the pytest.
- Return type:
function
Examples
Run a model by its ID with input data: $ ersilia run -i <input_data> --as-table Run a model with batch size: $ ersilia run -i <input_data> -b 50
ersilia.cli.commands.serve module¶
- ersilia.cli.commands.serve.serve_cmd()[source]¶
Serves a previously fetched model as a local API.
The model must already be available locally (see
ersilia fetch). After serving, useersilia runto send predictions to it.- Returns:
The serve command function to be used by the CLI and for testing in pytest.
- Return type:
function
Examples
Serve a model on a chosen port: $ ersilia serve <model_id> --port 8080 Serve a model with run tracking enabled: $ ersilia serve <model_id> --track
ersilia.cli.commands.test module¶
- ersilia.cli.commands.test.test_cmd()[source]¶
Test a model and obtain performance metrics.
This command allows you to test a model using various options to customize the testing process.
The command performs the following steps: - Sets up the model tester with the specified model and options. - Executes tests to evaluate the model’s performance, metadata check, output consistency and more. - Generates and outputs performance metrics.
Examples
With basic testing:/ $ ersilia test eosxxxx --from_dir /path/to/model With different sources to fetch the model: $ ersilia test eosxxxx --from_github/--from_dockerhub/--from_s3 With different levels of testing: $ ersilia test eosxxxx --shallow --from_github/--from_dockerhub/--from_s3
ersilia.cli.commands.uninstall module¶
Module contents¶
- class ersilia.cli.commands.ErsiliaCommandGroup(*args: Any, **kwargs: Any)[source]¶
Bases:
RichGroup- command(*args, **kwargs)[source]¶
A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as
command()and immediately registers the created command with this group by callingadd_command().To customize the command class used, set the
command_classattribute.Changed in version 8.1: This decorator can be applied without parentheses.
Changed in version 8.0: Added the
command_classattribute.
- main(*args, **kwargs)[source]¶
This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted,
SystemExitneeds to be caught.This method is also available by directly calling the instance of a
Command.- Parameters:
args – the arguments that should be used for parsing. If not provided,
sys.argv[1:]is used.prog_name – the program name that should be used. By default the program name is constructed by taking the file name from
sys.argv[0].complete_var – the environment variable that controls the bash completion support. The default is
"_<prog_name>_COMPLETE"with prog_name in uppercase.standalone_mode – the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of
invoke().windows_expand_args – Expand glob patterns, user dir, and env vars in command line args on Windows.
extra – extra keyword arguments are forwarded to the context constructor. See
Contextfor more information.
Changed in version 8.0.1: Added the
windows_expand_argsparameter to allow disabling command line arg expansion on Windows.Changed in version 8.0: When taking arguments from
sys.argvon Windows, glob patterns, user dir, and env vars are expanded.Changed in version 3.0: Added the
standalone_modeparameter.