grelu.resources#

grelu.resources contains additional data files that can be used by gReLU functions. It also contains functions to load these files as well as files stored externally, such as model checkpoints and datasets in the model zoo on huggingface.

For legacy wandb access, use grelu.resources.wandb.

Submodules#

Exceptions#

DeprecationError

Raised when deprecated API is used.

Functions#

get_meme_file_path(→ str)

Return the path to a MEME file.

get_blacklist_file(→ str)

Return the path to a blacklist file

list_models(→ List[str])

List all model repo IDs in the gReLU model zoo collection.

list_datasets(→ List[str])

List all dataset repo IDs in the gReLU model zoo collection.

download_model(→ str)

Download a model checkpoint file from HuggingFace.

download_dataset(→ str)

Download a dataset file from HuggingFace.

load_model(→ grelu.lightning.LightningModel)

Download and load a model from HuggingFace.

get_model_info(→ Dict[str, Any])

Get full model card metadata from HuggingFace.

get_dataset_info(→ Dict[str, Any])

Get full dataset card metadata from HuggingFace.

get_datasets_by_model(→ List[str])

Get datasets linked to a model (from 'datasets' field in model card).

get_base_models(→ List[str])

Get base models this model was fine-tuned from (from 'base_model' field).

get_models_by_dataset(→ List[str])

Get models trained on a dataset (searches collection models).

Package Contents#

grelu.resources.get_meme_file_path(meme_motif_db: str) str[source]#

Return the path to a MEME file.

Parameters:

meme_motif_db – Path to a MEME file or the name of a MEME file included with gReLU. Current name options are “hocomoco_v12”, “hocomoco_v13”, and “consensus”.

Returns:

Path to the specified MEME file.

grelu.resources.get_blacklist_file(genome: str) str[source]#

Return the path to a blacklist file

Parameters:

genome – Name of a genome whose blacklist file is included with gReLU. Current name options are “hg19”, “hg38” and “mm10”.

Returns:

Path to the specified blacklist file.

exception grelu.resources.DeprecationError[source]#

Bases: Exception

Raised when deprecated API is used.

grelu.resources.list_models() List[str][source]#

List all model repo IDs in the gReLU model zoo collection.

Returns:

List of model repository IDs (e.g., [“Genentech/human-atac-catlas-model”, …])

grelu.resources.list_datasets() List[str][source]#

List all dataset repo IDs in the gReLU model zoo collection.

Returns:

List of dataset repository IDs (e.g., [“Genentech/human-atac-catlas-data”, …])

grelu.resources.download_model(repo_id: str, filename: str = 'model.ckpt', **kwargs) str[source]#

Download a model checkpoint file from HuggingFace.

Parameters:
  • repo_id – HuggingFace repository ID (e.g., “Genentech/human-atac-catlas-model”)

  • filename – Name of the checkpoint file to download (default: “model.ckpt”)

  • **kwargs – Additional arguments to pass to hf_hub_download

Returns:

Local path to the downloaded file

grelu.resources.download_dataset(repo_id: str, filename: str = 'data.h5ad', **kwargs) str[source]#

Download a dataset file from HuggingFace.

Parameters:
  • repo_id – HuggingFace repository ID (e.g., “Genentech/human-atac-catlas-data”)

  • filename – Name of the dataset file to download (default: “data.h5ad”)

  • **kwargs – Additional arguments to pass to hf_hub_download

Returns:

Local path to the downloaded file

grelu.resources.load_model(repo_id: str | None = None, filename: str = 'model.ckpt', device: str | int = 'cpu', project: str | None = None, model_name: str | None = None) grelu.lightning.LightningModel[source]#

Download and load a model from HuggingFace.

Parameters:
  • repo_id – HuggingFace repository ID (e.g., “Genentech/human-atac-catlas-model”)

  • filename – Name of the checkpoint file (default: “model.ckpt”)

  • device – Device to load the model on (default: “cpu”)

Returns:

A LightningModel object

grelu.resources.get_model_info(repo_id: str) Dict[str, Any][source]#

Get full model card metadata from HuggingFace.

Parameters:

repo_id – HuggingFace repository ID

Returns:

Dictionary containing model metadata including list of files

grelu.resources.get_dataset_info(repo_id: str) Dict[str, Any][source]#

Get full dataset card metadata from HuggingFace.

Parameters:

repo_id – HuggingFace repository ID

Returns:

Dictionary containing dataset metadata including list of files

grelu.resources.get_datasets_by_model(repo_id: str) List[str][source]#

Get datasets linked to a model (from ‘datasets’ field in model card).

Parameters:

repo_id – HuggingFace model repository ID

Returns:

List of dataset repository IDs linked to this model

grelu.resources.get_base_models(repo_id: str) List[str][source]#

Get base models this model was fine-tuned from (from ‘base_model’ field).

Parameters:

repo_id – HuggingFace model repository ID

Returns:

List of base model repository IDs

grelu.resources.get_models_by_dataset(repo_id: str) List[str][source]#

Get models trained on a dataset (searches collection models).

Parameters:

repo_id – HuggingFace dataset repository ID

Returns:

List of model repository IDs that use this dataset