Skip to content

Custom models🔗

After exploring the platform's capabilities using the models pre-defined by Apheris, you have the option to add your own models. This requires the creation of a custom federated model and its integration into the Apheris infrastructure, which allows you to update your model at any time.

If you would like to build your own custom model please contact Apheris via your personal representative or support@apheris.com who can provide the necessary credentials and more details on this process.

The development path🔗

There are three main paths to develop federated models to the Apheris platform:

  • porting an existing model to use a federation framework
  • creating a federated model from scratch
  • wrap an existing docker image with our automated "black box" wrapping pipeline.

Currently the main federation framework we support is NVFlare. This list provides a starting point for using NVFlare with Apheris.

The black box pipeline allows you to integrate most docker images into Apheris, without modifying the code on your end. This integration is currently performed by Apheris as a service. You will need to provide a docker image and an example script to launch a computation inside of it.

Model sharing🔗

All models in the Apheris platform run as containers. Once you have developed a federated model that you want to share, you will need to containerize it. The container image needs to be uploaded to a container image repository, which Apheris will create and provide you access to. Alternatively, if you have the preview feature for model management configured, the Apheris Platform will take care of the repository creation and provide you with the necessary credentials to access it.

To upload your federated model image, you will get the following values from Apheris:

  • the repository_name;
  • associated credentials your_quay_username and your_quay_password.

To log in to the registry please use the following command and provide the password your_quay_password when prompted

docker login -u <your_quay_username> quay.io

Preview feature for model management🔗

Important

This is a preview feature. If you wish to try it, please speak to your Apheris representative to enable it.

If you have the preview feature for model management enabled and configured on the Apheris Platform and your instance of the Compute Gateway, you are able to utilize the following features for managing your custom models:

  • use the apheris models add command to add a new model to the Model Registry. Also, an instance of a Quay repository will be created for you.
  • use the apheris models show-robot command to get the credentials for the Quay repository. You can use those to log into Quay and push your model image. After having done so, you can add a new version.

For these commands to work on the Apheris CLI, you should set the environment variable APH_CLI_PREVIEW=true.

Tagging and pushing the image🔗

To tag your image (in other words assign a version to your model) with quay_tag use the following docker command

docker tag <local_image_name>:<local_tag> quay.io/apheris/<repository_name>:<remote_tag>

An example command to push your image to the repository repository_name

docker push quay.io/apheris/<repository_name>:<remote_tag>

Please register the following information while pushing the image to the repository:

  • the name of the repository repository_name where the image has been pushed
  • the tag remote_tag you assign to your image (also known as a model version)
  • the digest of your image that you can see while performing the push command (last line of the command output)
    <remote_tag>: digest: <digest> size: <size>
    

Model activation🔗

Please communicate the information specified in the previous section (repository_name, quay_tag, and digest) to your Apheris representative. As soon as Apheris adds the model to the Model Registry the new version of the model will then appear on the platform and can be treated like any other model.

Adding a new version to an existing model🔗

To add a new version to an existing model you need to have the model manager role. As an owner of an organization you can add the model manager role during the user creation or update it later.
Read more about user management.

Apheris Model Registry - editable models
When you are a model manager, you can find your models by applying the "editable models" filter. The filter is only visible if you created a custom model and have the model manager role.

Once the user has this role, updating the model version can be achieved via the Apheris CLI models add-version CLI command. The version value itself must follow semantic versioning rules, optionally followed by -additional-alpha-numeric-identifier (e.g. 1.0.0-initially-released-version-of-our-awesome-model). If the custom models preview feature is enabled, the corresponding digest and version match will be checked against a remote repository (i.e. quay.io) to ensure the integrity of the model.

You can use the models list-versions CLI command to list all versions of a given model that are available in your Model Registry.

Apheris Governance Portal user management
To update a custom model, a user needs to have the model manager role. It can be set in the Governance Portal by owner users.

Running the model🔗

To run the model, a data custodian must have selected this particular model in the permissions section when setting the asset policy.