API
thunder.benchmark.benchmark(model, dataset, task, loading_mode='online_loading', lora=False, ckpt_save_all=False, online_wandb=False, **kwargs)
Runs a benchmark for a pretrained model on a dataset with a task-specific approach.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
str
|
The name of the pretrained model to use. |
required |
dataset
|
str
|
The name of the dataset to use. |
required |
task
|
str
|
The name of the task to perform. |
required |
loading_mode
|
str
|
The type of data loading to use. |
'online_loading'
|
lora
|
bool
|
Whether to use LoRA (Low-Rank Adaptation) for model adaptation. Default is False. |
False
|
ckpt_save_all
|
bool
|
Whether to save all checkpoints during training. Default is False which means that only the best is saved. |
False
|
online_wandb
|
bool
|
Whether to use online mode for Weights & Biases (wandb) logging. Default is False which means offline mode. |
False
|
Source code in .venv/lib/python3.10/site-packages/thunder/benchmark.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
thunder.download_datasets(datasets, make_splits=False)
Downloads the benchmark datasets specified in the list of dataset names.
This function requires the $THUNDER_BASE_DATA_FOLDER
environment variable to be set,
which indicates the base directory where the datasets will be downloaded.
The list of all available datasets
- bach
- bracs
- break_his
- ccrcc
- crc
- esca
- mhist
- ocelot
- pannuke
- patch_camelyon
- segpath_epithelial
- segpath_lymphocytes
- tcga_crc_msi
- tcga_tils
- tcga_uniform
- wilds
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datasets
|
List[str] or str
|
A dataset name string or a List of dataset names to download or one of the following aliases: |
required |
make_splits
|
bool
|
Whether to generate data splits for the datasets. Defaults to False. |
False
|
Source code in .venv/lib/python3.10/site-packages/thunder/datasets/download.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
thunder.download_models(models)
Download model checkpoints from Hugging Face.
The list of all available models
- uni
- uni2h
- virchow
- virchow2
- hoptimus0
- hoptimus1
- conch
- titan
- phikon
- phikon2
- hiboub
- hiboul
- midnight
- keep
- quiltb32
- plip
- musk
- dinov2base
- dinov2large
- vitbasepatch16224in21k
- vitlargepatch16224in21k
- clipvitbasepatch32
- clipvitlargepatch14
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models
|
List[str] or str
|
a list of model names or single a model name str. |
required |
Source code in .venv/lib/python3.10/site-packages/thunder/models/download.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
thunder.generate_splits(datasets)
Generates the data splits for all datasets in input list.
This function requires the $THUNDER_BASE_DATA_FOLDER
environment variable to be set,
which indicates the base directory where the datasets will be downloaded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datasets
|
List[str]
|
List of dataset names to generate splits for or one of the following aliases: |
required |
Source code in .venv/lib/python3.10/site-packages/thunder/datasets/data_splits.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
thunder.models.PretrainedModel
Bases: Module
, ABC
Abstract class to be inherited by custom pretrained models.
Source code in .venv/lib/python3.10/site-packages/thunder/models/pretrained_models.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
get_linear_probing_embeddings(x)
abstractmethod
Returns the embeddings for linear probing.
Source code in .venv/lib/python3.10/site-packages/thunder/models/pretrained_models.py
20 21 22 23 |
|
get_segmentation_embeddings(x)
abstractmethod
Returns the pixel dense embeddings for segmentation.
Source code in .venv/lib/python3.10/site-packages/thunder/models/pretrained_models.py
25 26 27 28 |
|
get_transform()
abstractmethod
Returns the transform function to be applied to the input images.
Source code in .venv/lib/python3.10/site-packages/thunder/models/pretrained_models.py
15 16 17 18 |
|