Load
NGCDownloader
dataclass
A class to download files from NGC in a Pooch-compatible way.
NGC downloads are typically structured as directories, while pooch expects a single file. This class downloads a single file from an NGC directory and moves it to the desired location.
Source code in bionemo/core/data/load.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
__call__(url, output_file, _)
Download a file from NGC.
Source code in bionemo/core/data/load.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
default_ngc_client()
Create a default NGC client.
This should load the NGC API key from ~/.ngc/config, or from environment variables passed to the docker container.
Source code in bionemo/core/data/load.py
69 70 71 72 73 74 |
|
default_pbss_client()
Create a default S3 client for PBSS.
Source code in bionemo/core/data/load.py
44 45 46 47 |
|
entrypoint()
Allows a user to get a specific artifact from the command line.
Source code in bionemo/core/data/load.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
load(model_or_data_tag, source='pbss', resources=None, cache_dir=None)
Download a resource from PBSS or NGC.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_or_data_tag
|
str
|
A pointer to the desired resource. Must be a key in the resources dictionary. |
required |
source
|
Literal['ngc', 'pbss']
|
Either "pbss" (NVIDIA-internal download) or "ngc" (NVIDIA GPU Cloud). Defaults to "pbss". |
'pbss'
|
resources
|
dict[str, Resource] | None
|
A custom dictionary of resources. If None, the default resources will be used. (Mostly for testing.) |
None
|
cache_dir
|
Path | None
|
The directory to store downloaded files. Defaults to BIONEMO_CACHE_DIR. (Mostly for testing.) |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If the desired tag was not found, or if an NGC url was requested but not provided. |
Returns:
Type | Description |
---|---|
Path
|
A Path object pointing either at the downloaded file, or at a decompressed folder containing the |
Path
|
file(s). |
Examples:
For a resource specified in 'filename.yaml' with tag 'tag', the following will download the file:
>>> load("filename/tag")
PosixPath(/tmp/bionemo/downloaded-file-name)
Source code in bionemo/core/data/load.py
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
main(download_all, list_resources, artifact_name, source)
Main download script logic: parameters are 1:1 with CLI flags. Returns string describing error on failure.
Source code in bionemo/core/data/load.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
print_resources(*, output_source=sys.stdout)
Prints all available downloadable resources & their sources to STDOUT.
Source code in bionemo/core/data/load.py
210 211 212 213 214 215 216 217 218 219 |
|