NVIDIA GPU Cloud SDK
Actively maintained. Last release 12 days ago. A safe choice.
pip install ngcsdkNGC-SDK
The NVIDIA NGC software development kit to interact and develop Python utilities and applications to integrate with the NVIDIA GPU Cloud.
Prerequisites
Python version >= 3.9
Install from pypi
Install the package from pypi.org by running the following command:
pip install ngcsdk
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.
Extras
Some features require additional dependencies, which are optional unless you need enhanced telemetry.
To install these extras, use:
pip install ngcsdk[telemetry]
After installing the SDK, the first step is to create and configure the client.
Creating and configuring NGC SDK client
To set the configuration, run the following functions.
Tip
This needs an API key. For information about generating an API key, refer to the setup, https://ngc.nvidia.com/setup.
from ngcsdk import Client
clt = Client()
clt.configure(api_key='****NkMQ', org_name='nvidia', team_name='no-team')
Validating configuration...
Successfully validated configuration.
clt.current_config()
[{'key': 'apikey', 'value': '****NkMQ', 'source': 'user settings'},
{'key': 'format_type', 'value': 'ascii', 'source': 'user settings'},
{'key': 'org', 'value': 'nvidia', 'source': 'user settings'},
{'key': 'team', 'value': 'no-team', 'source': 'user settings'}]
Debugging
Configure debug logging using Python's logging utility.
import logging
from ngcsdk import Client
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
clt = Client()
model = clt.registry.model.info("nvidia/nemotron")
DEBUG:ngcbase.api.connection:Requesting URL (GET): https://api.stg.ngc.nvidia.com/v2/org/nvidia/model/nemotron
payload: None
params: None
DEBUG:ngcbase.api.authentication:Retrieving API Key Token from cache....
DEBUG:ngcbase.api.authentication:Token in use: ****hPWE
DEBUG:ngcbase.api.authentication:Expiration time of token: '2024-03-07 16:36:03.849188'
DEBUG:ngcbase.api.authentication:Fetched token from the cache. Expires 2024-03-07 16:36:03.849188
DEBUG:ngcbase.api.utils:Headers:
DEBUG:ngcbase.api.utils:{'Content-Type': 'application/json', ...}
DEBUG:ngcbase.api.connection:Response status: 200 - Reason: OK
DEBUG:ngcbase.api.connection:Time taken to process URL: https://api.stg.ngc.nvidia.com/v2/org/nvidia/model/nemotron: 0.34587s
DEBUG:ngcbase.api.connection:Response is: {"requestStatus":{"statusCode":"SUCCESS"}, ...}