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/scdl/data/load.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
__call__(url, output_file, _)
Download a file from NGC.
Source code in bionemo/scdl/data/load.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
Resource
dataclass
Class that represents a remote resource for downloading and caching test data.
Source code in bionemo/scdl/data/load.py
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 |
|
decompress = None
class-attribute
instance-attribute
Whether the resource should be decompressed after download.
description = None
class-attribute
instance-attribute
A description of the file(s).
ngc = None
class-attribute
instance-attribute
The NGC URL for the resource.
owner = ''
class-attribute
instance-attribute
The owner or primary point of contact for the resource.
pbss = None
class-attribute
instance-attribute
The PBSS URL of the resource.
sha256 = None
class-attribute
instance-attribute
The SHA256 checksum of the resource.
tag
instance-attribute
A unique identifier for the resource.
unpack = None
class-attribute
instance-attribute
Whether the resource should be unpacked after download.
default_ngc_client(use_guest_if_api_key_invalid=True)
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/scdl/data/load.py
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 |
|
default_pbss_client()
Create a default S3 client for PBSS.
Source code in bionemo/scdl/data/load.py
229 230 231 232 233 234 235 236 237 238 |
|
get_all_resources(resource_path=None)
cached
Return a dictionary of all resources.
Source code in bionemo/scdl/data/load.py
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 |
|
load(model_or_data_tag, source=DEFAULT_SOURCE, 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
|
SourceOptions
|
Either "pbss" (NVIDIA-internal) or "ngc" (NGC). Defaults to DEFAULT_SOURCE (from environment variable BIONEMO_DATA_SOURCE; defaults to "ngc"). |
DEFAULT_SOURCE
|
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/scdl/data/load.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
|