scvi.hub.HubModelCardHelper#

class scvi.hub.HubModelCardHelper(license_info, model_cls_name, model_init_params, model_setup_anndata_args, model_summary_stats, model_data_registry, scvi_version, anndata_version, data_modalities=<factory>, tissues=<factory>, data_is_annotated=None, data_is_minified=None, training_data_url=None, training_code_url=None, model_parent_module='scvi.model', description='To be added...', references='To be added...')[source]#

A helper for creating a ModelCard for scvi-tools hub models.

Parameters:
  • license_info (str) – The license information for the model.

  • model_cls_name (str) – The name of the model class.

  • model_init_params (dict) – The model initialization parameters.

  • model_setup_anndata_args (dict) – The arguments used to call setup_anndata during model training.

  • model_summary_stats (dict) – The model summary statistics.

  • model_data_registry (dict) – The model data registry.

  • scvi_version (str) – The version of scvi-tools that the model was trained with.

  • anndata_version (str) – The version of anndata used during model training.

  • data_modalities (list[str] (default: <factory>)) – The modalities of the training data.

  • tissues (list[str] (default: <factory>)) – The tissues of the training data.

  • data_is_annotated (bool | None (default: None)) – Whether the training data is annotated.

  • data_is_minified (bool | None (default: None)) – Whether the training data uploaded with the model has been minified.

  • training_data_url (str | None (default: None)) – Link to the training data used to train the model, if it is too large to be uploaded to the hub. This can be a cellxgene explorer session url. However it cannot be a self-hosted session – it must be from the cellxgene portal (https://cellxgene.cziscience.com/).

  • training_code_url (str | None (default: None)) – Link to the code used to train the model.

  • model_parent_module (str (default: 'scvi.model')) – The parent module of the model class. Defaults to scvi.model. Change this if you are using a model class that is not in the scvi.model module, for example, if you are using a model class from a custom module.

  • description (str (default: 'To be added...')) – A description of the model.

  • references – A list of references for the model.

Notes

It is not required to use this class to create a ModelCard. But this helps you do so in a way that is consistent with most other scvi-tools hub models. You can think of this as a template. The actual template string used can be found in scvi.template. The resulting huggingface ModelCard can be accessed via the model_card() property.

Attributes table#

Methods table#

from_dir(local_dir, license_info, ...[, ...])

Create a HubModelCardHelper object from a local directory.

Attributes#

HubModelCardHelper.data_is_annotated: bool | None = None#
HubModelCardHelper.data_is_minified: bool | None = None#
HubModelCardHelper.description: str = 'To be added...'#
HubModelCardHelper.model_parent_module: str = 'scvi.model'#
HubModelCardHelper.references: str = 'To be added...'#
HubModelCardHelper.training_code_url: str | None = None#
HubModelCardHelper.training_data_url: str | None = None#
HubModelCardHelper.license_info: str#
HubModelCardHelper.model_cls_name: str#
HubModelCardHelper.model_init_params: dict#
HubModelCardHelper.model_setup_anndata_args: dict#
HubModelCardHelper.model_summary_stats: dict#
HubModelCardHelper.model_data_registry: dict#
HubModelCardHelper.scvi_version: str#
HubModelCardHelper.anndata_version: str#
HubModelCardHelper.data_modalities: list[str]#
HubModelCardHelper.tissues: list[str]#

Methods#

classmethod HubModelCardHelper.from_dir(local_dir, license_info, anndata_version, data_is_minified=None, map_location='cpu', **kwargs)[source]#

Create a HubModelCardHelper object from a local directory.

Parameters:
  • local_dir (str) – The local directory containing the model files.

  • license_info (str) – The license information for the model.

  • anndata_version (str) – The version of anndata used during model training.

  • data_is_minified (bool | None (default: None)) – Whether the training data uploaded with the model has been minified.

  • map_location (device | str | dict | None (default: 'cpu')) – The device to map model tensors to, passed into load().

  • kwargs – Additional keyword arguments to pass to the HubModelCardHelper initializer.