scvi.hub.HubMetadata#

class scvi.hub.HubMetadata(scvi_version, anndata_version, model_cls_name, training_data_url=None, model_parent_module='scvi.model')[source]#

Encapsulates the required metadata for scvi-tools hub models.

Parameters:
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.

model_cls_name str

The name of the model class.

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/).

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.

Attributes table#

Methods table#

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

Create a HubMetadata object from a local directory.

save(save_path[, overwrite])

Save the metadata to a JSON file.

Attributes#

HubMetadata.model_parent_module: str = 'scvi.model'#
HubMetadata.training_data_url: str | None = None#
HubMetadata.scvi_version: str#
HubMetadata.anndata_version: str#
HubMetadata.model_cls_name: str#

Methods#

classmethod HubMetadata.from_dir(local_dir, anndata_version, map_location='cpu', **kwargs)[source]#

Create a HubMetadata object from a local directory.

Parameters:
local_dir str

The local directory containing the model files.

anndata_version str

The version of anndata used during model training.

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 HubMetadata initializer.

HubMetadata.save(save_path, overwrite=False)[source]#

Save the metadata to a JSON file.

Parameters:
save_path str

The path to which to save the metadata as a JSON file.

overwrite bool (default: False)

Whether to overwrite the file if it already exists.

Return type:

None